//javascript functions used in project
function showDiv(divID) {
	var div = document.getElementById(divID);
	div.style.display = "block";
}

function hideDiv(divID) {
	var div = document.getElementById(divID);
	div.style.display = "none";
}

function toggleDiv(divID) {
	var div = document.getElementById(divID);
	if(div.style.display == 'none') {
		div.style.display = 'block';
	} else {
		div.style.display = 'none';
	}
}

function clearBox(box) {
	if(box.value==box.defaultValue) {
		box.value = "";
	}
}

function bookmarksite(title, link){
	if(!title)
		title = document.title;
	if(!link)
		link = location.href;
	
	if (document.all)
		window.external.AddFavorite(link, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, link, "");
	else if(window.opera && window.print)
		return true;
}

/* ajax */
var xmlHttp=null;
function GetXmlHttpObject() {
	try {
		xmlHttp=new XMLHttpRequest();	// Firefox, Opera 8.0+, Safari
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
	return xmlHttp;
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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 openWindow(url,height,width){
	window.open(url,'','scrollbars=no,menubar=no,width='+width+',height='+height+',resizable=no,toolbar=no,location=no,status=no');
}
