//// Javascript Library
//// All Rights Reserved
	function printPreview(url,DefaultWidth) {
	//	var DefaultWidth = 580;
		var winl = (screen.width - DefaultWidth) / 2;
		
		Width = DefaultWidth;
		if (DefaultWidth > screen.width) {
			Width = screen.width;
		}
		
		preview = window.open(url, 'printPreviewwindow','width='+Width+',top='+100+',left='+winl+',toolbar=no,menubar=yes,dependent=yes,resizable=yes,scrollbars=yes');
		preview.focus();
	}

	function ButtonDown(object) {
		object.className = 'button_DOWN';
	}
	
	function ButtonUp(object) {
		object.className = 'button_UP';
	}

	function writeCookie(name, value, hours)
	{
	  var expire = "";
	  if(hours != null)
	  {
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString();
	  }
	  document.cookie = name + "=" + escape(value) + expire;
	}
	
	function getCookie(name) {
		return document.cookies[name];
	}

	function HideElem(elem) {
		if (!document.getElementById(elem)) return;
		document.getElementById(elem).style.visibility = 'hidden';
		document.getElementById(elem).style.position = 'absolute';
		document.getElementById(elem).style.top = 0;
		document.getElementById(elem).style.left = 0;
	}
	
	function ShowElem(elem) {
		if (!document.getElementById(elem)) return;
		document.getElementById(elem).style.visibility = 'visible';
		document.getElementById(elem).style.position = 'relative';
	}

	function DisableItem(what) {
		what.disabled = true;
	}

	function popupWindow(url,resizable) {
		if (resizable == 1)
		window.open(url,'_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=400,top=150,left=150'); else
		window.open(url,'_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=400,top=150,left=150');
	}

	function isEmail(string) {
		if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
		else
		return false;
	}


	function explodeArray(item,delimiter) {
	  tempArray=new Array(1);
	  var Count=0;
	  var tempString=new String(item);
	
	  while (tempString.indexOf(delimiter)>0) {
		tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
		tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); 
		Count=Count+1
	  }
	
	  tempArray[Count]=tempString;
	  return tempArray;
	}
	
	
	
	function SelectItem(select_box,item_) {
		var whichitem = 0;
		if (document.getElementById(select_box) == null) return;
		while (whichitem < document.getElementById(select_box).length) {
			if (document.getElementById(select_box).options[whichitem].text == item_) {
				document.getElementById(select_box).selectedIndex = whichitem; 
				break;
			}
			whichitem++;
		}
	}
	function SelectItemByValue(select_box,item_) {
		var whichitem = 0;
		if (document.getElementById(select_box) == null) return;
		while (whichitem < document.getElementById(select_box).length) {
			if (document.getElementById(select_box).options[whichitem].value == item_) {
				document.getElementById(select_box).selectedIndex = whichitem; 
				break;
			}
			whichitem++;
		}
	}
