// JavaScript Document

<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function toggleIt(id) {
	if (document.getElementById(id).style.display == 'none') {
		toggleVisibility(id,'block','block','block');
	} else {
		toggleVisibility(id,'none','none','none');
	}
}

function tmt_confirm(msg){
	document.MM_returnValue=(confirm(unescape(msg)));
}

function toggleDisplay(strElement) {
	if( document.getElementById(strElement).style.display == "none" ) {
		document.getElementById(strElement).style.display = "block";
	} else {
		document.getElementById(strElement).style.display = "none"; }
}

function togOff(strElement) {
	document.getElementById(strElement).style.display = "none";
}

function togOn(strElement) {
	document.getElementById(strElement).style.display = "";
}


function getDropdownSelectedValue(DD_ID) {
	var e = document.getElementById(DD_ID); // select element
	var val = e.options[e.selectedIndex].value;
	return val;
}


    function addClassNamesToInputs() {
        var inputs = document.getElementsByTagName("input");
        for (var i=0; i<inputs.length; i++) {
            inputs[i].className = inputs[i].type;
        }
    }

// **** CSS BASED NAVIGATION - START *** //

/*
sfHover = function() { 
	var sfEls = document.getElementById("nav").getElementsByTagName("LI"); 
		for (var i=0; i<sfEls.length; i++) { 
			sfEls[i].onmouseover=function() { 
			this.className+=" sfhover"; 
		} 
		sfEls[i].onmouseout=function() { 
			this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); 
		} 
	} 
} 

if (window.attachEvent) window.attachEvent("onload", sfHover);
*/
// **** CSS BASED NAVIGATION - END *** //


function OpenImgPop(PhotoLocation, iwidth, iheight){
	leftPos = 0
	topPos = 0
	if (screen) {
	leftPos = (screen.width / 2) - (iwidth/2)
	topPos = (screen.height / 2) - (iheight/2)
	}
	if (typeof newWindow != 'undefined') {
	newWindow.close()
	}
	newWindow = window.open('','newWin','width='+iwidth+',height='+iheight+', left='+leftPos+',top='+topPos)
	newWindow.document.write ("<HTML> <HEAD> <TITLE></TITLE><link href='css/styles.css' rel='stylesheet' type='text/css'> </HEAD> <BODY leftmargin=0 bottommargin=0 rightmargin=0 topmargin=0 text='#000000' onLoad='window.focus();' > <DIV ALIGN='center'> <a href='javascript:window.close();' title='Click to close'><IMG SRC=" + PhotoLocation + " border=0></a> </DIV> </BODY> </HTML> ")
}

function OpenRegImgPop(PhotoLocation, iwidth, iheight){
	leftPos = 0
	topPos = 0
	if (typeof newWindow != 'undefined') {
	newWindow.close()
	}
	newWindow = window.open('','newWin','width='+iwidth+',height='+iheight+', left='+leftPos+',top='+topPos)
	newWindow.document.write ("<HTML> <HEAD> <TITLE></TITLE><link href='css/styles.css' rel='stylesheet' type='text/css'> </HEAD> <BODY leftmargin=0 bottommargin=0 rightmargin=0 topmargin=0 text='#000000' onLoad='window.focus();' > <DIV ALIGN='center'> <a href='javascript:window.close();' title='Click to close'><IMG SRC=" + PhotoLocation + " border=0></a> </DIV> </BODY> </HTML> ")
}

function OpenCenteredPop(Url, iwidth, iheight){
	leftPos = 0
	topPos = 0
	if (screen) {
	leftPos = (screen.width / 2) - (iwidth/2)
	topPos = (screen.height / 2) - (iheight/2)
	}
	if (typeof newWindow != 'undefined') {
	newWindow.close()
	}
	newWindow = window.open(Url,'newWin','width='+iwidth+',height='+iheight+', left='+leftPos+',top='+topPos)
}

function OpenRegPop(Url, iwidth, iheight){
	leftPos = 0
	topPos = 0
	if (typeof newWindow != 'undefined') {
	newWindow.close()
	}
	newWindow = window.open(Url,'newWin','width='+iwidth+',height='+iheight+', left='+leftPos+',top='+topPos)
}

function OpenRegPopScroll(Url, iwidth, iheight){
	leftPos = 0
	topPos = 0
	if (typeof newWindow != 'undefined') {
	newWindow.close()
	}
	newWindow = window.open(Url,'newWin','width='+iwidth+',height='+iheight+', left='+leftPos+',top='+topPos+',scrollbars=yes,resizable=yes')
}

function SelfCenteredPop(Url, iwidth, iheight){
	leftPos = 0
	topPos = 0
	if (screen) {
	leftPos = (screen.width / 2) - (iwidth/2)
	topPos = (screen.height / 2) - (iheight/2)
	}
	if (typeof popWindow != 'undefined') {
	popWindow.close()
	}
	popWindow = window.open(Url,'newPop','width='+iwidth+',height='+iheight+', left='+leftPos+',top='+topPos)
}

//-->

//<!-- Input manipulation

function checkBoxSelected(chkBoxContainerID, alertMsg)
{
	var countChecked = 0;
	
	inputTags = document.getElementById(chkBoxContainerID).getElementsByTagName('input') 

    for (i=0; i<inputTags.length; ++ i) { 
        if (inputTags[i].type=="checkbox" && inputTags[i].checked)
		{
			countChecked = countChecked+1; 
		}
    }
	
	if (countChecked > 0)
	{
		return 0;
	} else {
		alert(alertMsg);
		return 1;
	}
}

function checkSomeBoxesSelected(containerList)
{
	var arrContainers = containerList.split(",")
	var countFalse = 0;
	var ret = true;
	
	for (n=0; n<arrContainers.length; ++ n) {
		var Duo = arrContainers[n]
		//alert(Duo + n);
		var arrContainerDuo = Duo.split(":");
		var res = checkBoxSelected(arrContainerDuo[0], arrContainerDuo[1]);
		countFalse = countFalse+res;
	}

	if (countFalse > 0)
	{
		return false;
	} else {
		return true;
	}

}


function SelectCheckBoxes(chkBoxContainerID, selectedAction)
{	
	inputTags = document.getElementById(chkBoxContainerID).getElementsByTagName('input') 

    for (i=0; i<inputTags.length; ++ i) { 
        if (selectedAction == true)
		{
            if (inputTags[i].type=="checkbox")
		    {
			    inputTags[i].checked = true;
		    }
		}
        else
	    {
            if (inputTags[i].type=="checkbox")
		    {
			    inputTags[i].checked = false;
		    }
	    }
    }
}


//-->