//-- Common Javascript Functions --//

var questions = document.getElementsByTagName('dt');
var answers = document.getElementsByTagName('dd');

/* Opens a url in a new window */
function openWindow(url){
	var width = screen.availWidth/1.25;
    var height = screen.availHeight/1.25;
    var left = parseInt((screen.availWidth/1.25) - (width));
    var top = parseInt((screen.availHeight/1.25) - (height));
    var windowFeatures = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open(url, "", windowFeatures);
    return myWindow;
}

/* Enables/disables all elements in a form */
function enableFormElems(form) {
	for(i = 0; i < form.elements.length; i++) {
		var elem = form.elements[i];
		if (elem.type != 'submit' && elem.type != 'hidden' && elem.type != 'button') {
			elem.disabled = !elem.disabled;
		}
	}
}

/* Toggles the editing of a form */
function toggleEdit(elem, form) {
	enableFormElems(form);
	if (elem.value == 'Edit') {
		elem.value = 'Cancel';
	} else {
		elem.value = 'Edit';
	}
}

/* Sets the inner html of a div */
function setDivHtml(divId, value) {
	document.getElementById(divId).innerHTML = value;
}

/* Toggles an answer to a faq on and off */
function displayToggle(){
	
	// calls the toggle all off function 
	// to turn all the answers off when the page is loaded     
	toggleAllOff(); 

	for (i=0; i<questions.length; i++) {  // loops through the questions
		questions[i].onclick = function() {  // shows the answers onclick
        var next = this.nextSibling;
        // if it gets to a non-element node, go to the next one
        while(next.nodeType != 1) next = next.nextSibling;
        	next.className = ((next.className=="hidden") ? "showHidden" : "hidden");
		}
	}
}

/* Function for the link that turns all faqs off */
function toggleAllOff(){
     for (var i = 0; i < answers.length; i++) {
        answers[i].className = 'hidden';
     }
}
        
/* Function for the link that turns all faqs on */
function toggleAllOn(){
     for (var i = 0; i < answers.length; i++) {
        answers[i].className = 'showHidden';
     }
}



/**** SLA stuff ****/
function I3_Top(){
	/* Symantec Corporation. Indepth For Web code */
	if (typeof(TextDate) == 'undefined' && location.host != "") {
		var isFrameSet="false";
		TextDate = new Date();
		MoTextTime = TextDate.getTime() + 1;
		document.write('<script language="JavaScript1.2" src=\"' + location.protocol + '//' + location.host + '/veritas_i4t_agents/pssift_s1.js">'+ '<\/script>');
	}
}

function I3_Bottom(){
	/* Symantec Corporation. Indepth For Web code */
	if (typeof(pssscript1) != 'undefined') {
		document.write('<script language="JavaScript1.2" src=\"' + location.protocol + '//' + location.host + '/veritas_i4t_agents/pssift_s2.js">'+ '<\/script>');
	}
}