function toggle(elementid) {
	var theItem = $(elementid);

	if( theItem.style.display == "none")	{
		new Effect.BlindDown(theItem, {duration: 0.5});
	}else{
		new Effect.BlindUp(theItem, {duration: 0.5});
	}
}

function hideLoader(loader, target) {
	new Effect.Fade($(loader), {duration: 0.5});
	new Effect.BlindDown($(target));
}

var newwindow = ''
function popup(url) {
if (newwindow.location && !newwindow.closed) {
    newwindow.location.href = url; 
    newwindow.focus(); } 
else { 
    newwindow=window.open(url,'htmlname','width=500,height=450,toolbar=0,scrollbars=1');} 
}

var newwindow = ''
function serialpop(url) {
if (newwindow.location && !newwindow.closed) {
    newwindow.location.href = url; 
    newwindow.focus(); } 
else { 
    newwindow=window.open(url,'htmlname','width=707,height=200,toolbar=0,scrollbars=0');} 
}

function tidy() {
if (newwindow.location && !newwindow.closed) { 
   newwindow.close(); } 
}

var newwindow = ''
function popuplarge(url) {
if (newwindow.location && !newwindow.closed) {
    newwindow.location.href = url; 
    newwindow.focus(); } 
else { 
    newwindow=window.open(url,'htmlname','width=750,height=600,toolbar=0,scrollbars=1');} 
}

function tidy() {
if (newwindow.location && !newwindow.closed) { 
   newwindow.close(); } 
}

var g_USER_AGENT = getAgent();
// return NN4, NN5(Netscape 6+, Mozilla 1+?), IE4, IE5(IE5+), Unknown
function getAgent(){
  	var userAgent = navigator.userAgent;
  	var charIndex;
  	var majorVersion;
		
  	charIndex = userAgent.indexOf("MSIE");
  	if(charIndex){
		majorVersion = userAgent.charAt(charIndex + 4 + 1);
		if(majorVersion > 4){
		  return("IE5");
		}
		else if(majorVersion == 4){
		  return("IE4");
		}
		}
		
		charIndex = userAgent.indexOf("Mozilla");
		majorVersion = userAgent.charAt(charIndex + 7 + 1);
		if(majorVersion > 4){
		return("NN5");
		}
		else if(majorVersion == 4){
		return("NN4");
		}
		
		return("Unknown");
		}

function getWindowYOffset(){
  	if(g_USER_AGENT == "IE5" || g_USER_AGENT == "IE4"){
		return document.body.scrollTop;
		}else if(g_USER_AGENT == "NN5" || g_USER_AGENT == "NN4"){
		return window.pageYOffset;
		}else{
		return 0;
		}
		}
		
		var waitTimer;
		function jumpTo(dstY, srcY, scrollRate, waitMillSec) {
		if(waitTimer){
		clearTimeout(waitTimer);
		}
		if( ! dstY || dstY < 0 ){
		dstY = 0;
		}
		if( ! srcY ){
		srcY = 0 + getWindowYOffset();
		}
		if( ! scrollRate ){
		scrollRate = 6;
		}
		if( ! waitMillSec ){
		waitMillSec = 20;
		}
		
		srcY += (dstY - getWindowYOffset()) / scrollRate;
		if(srcY < 0){
		srcY = 0;
		}
		posY = Math.floor(srcY);
		window.scrollTo(0, posY);
		
		if(posY != dstY){
		waitTimer = setTimeout("jumpTo("+ dstY +", "+ srcY +", "+ scrollRate +", "+ waitMillSec +")", waitMillSec);
		}
		else if(posY == dstY){
		clearTimeout(waitTimer);
		}
		else if(posY < 1){
		window.scroll(0, 0);
		}
		}
		
function backUp(){
	  jumpTo(0, 0, 7, 14);
		}

// Support Drop Down Menus

function menu_goto( menuform ) 
{
    var baseurl = "" ;
    selecteditem = menuform.newurl.selectedIndex ;
    newurl = menuform.newurl.options[ selecteditem ].value ;
    if (newurl.length != 0) {
      location.href = baseurl + newurl ;
    }
}

// SUPPORT PAGES

function getElementsByName_iefix(tag, name) {
    var elements = document.getElementsByTagName(tag);
    var nodes = new Array;
    for (i = 0, indexarray = 0; i < elements.length; i++) {
        att = elements[i].getAttribute("name");
        if (att == name) {
            nodes[indexarray] = elements[i];
            indexarray++;
        }
    }
    return nodes;
}

function togglearticle(id) {
    var answerNode = document.getElementById("answer-" + id);
    var questionNode = document.getElementById("question-" + id);
    if (answerNode.style.display == "block") {
        answerNode.style.display = "none";
        questionNode.className = "faq_question";
    } else {
        answerNode.style.display = "block";
        questionNode.className = "faq_question_expanded";
    }
    return false;
}

function hideAll(id) {
    var nodes = getElementsByName_iefix("div", "answer-cat-" + id);
    for (var i = 0; i < nodes.length; i++) {
        nodes[i].style.display = "none";
    }
    var revealNode = document.getElementById("reveal-cat-" + id);
    revealNode.style.display = "inline";
    var hideNode = document.getElementById("hide-cat-" + id);
    hideNode.style.display = "none";
    return false;
}

function showAll(id) {
    var nodes = getElementsByName_iefix("div", "answer-cat-" + id);
    for (var i = 0; i < nodes.length; i++) {
        nodes[i].style.display = "block";
    }
    var revealNode = document.getElementById("reveal-cat-" + id);
    revealNode.style.display = "none";
    var hideNode = document.getElementById("hide-cat-" + id);
    hideNode.style.display = "inline";
    return false;
}

// onFocus and onBlur events for Article rating on Help Docs and KB

function ClearFeedback(tfTextInput, strDefault)
{
	if (tfTextInput.value == strDefault)
	{
		tfTextInput.value = "";
		$("input#rate_feedback").removeClass("helpertext");
	}
}

function RepopulateFeedback(tfTextInput, strDefault)
{
	if (tfTextInput.value == "")
	{
		tfTextInput.value = strDefault;
		$("input#rate_feedback").addClass("helpertext");
	}
}

function ClearEmail(teTextInput, txtDefault)
{
	if (teTextInput.value == txtDefault)
	{
		teTextInput.value = "";
		$("input#rate_email").removeClass("helpertext");
	}
}

function RepopulateEmail(teTextInput, txtDefault)
{
	if (teTextInput.value == "")
	{
		teTextInput.value = txtDefault;
		$("input#rate_email").addClass("helpertext");
	}
}