// JavaScript Document

	// Clear form field function
	// Usage: onFocus="clearFld(this.form,'fieldname','fieldvalue');
		
function clearFld(formobj,whichFld,whatValue){
	for (var i = 0; i < formobj.length; i++){
		var obj = formobj.elements[i];
		if(obj.name==whichFld){
			if(obj.value==whatValue){
				obj.value="";
			}
		}
	}
}

function popup(sUrl,sName,iHeight,iWidth,bStatus,bMenubar,bToolbar,bResiz,bScroll) {
	newwindow=window.open(sUrl,sName,'height='+iHeight+',width='+iWidth+',status='+bStatus+',menubar='+bMenubar+',toolbar='+bToolbar+',resizable='+bResiz+',scrollbars='+bScroll+'');
		if (window.focus) {newwindow.focus()}
	return false;
}

function loadMenuFx() {
	var objffNode = document.getElementById('updateFx');
    new Effect.Highlight(objffNode, { startcolor: '#f0b000', endcolor: '#fef9ec', duration:2 }); return false;
}

function ShowHideLayer(boxID,cssClass) {
	/* Obtain reference for the selected boxID layer and its button */
	var box = document.getElementById("box"+boxID);
	var boxbtn = document.getElementById("btn"+boxID);
	
	/* If the selected box is currently invisible, show it */
	if(box.style.display == "none" || box.style.display=="") {
		box.style.display = "block";
 		boxbtn.className = cssClass+"Open"; // set new Css class
	}
	/* otherwise hide it */
	else {
		box.style.display = "none";
		boxbtn.className = cssClass;
	}
}

// font resize
var textsize = 11;
function changetextsize(up){
	if(up){
		textsize = parseFloat(textsize)+1;
	}else{
		textsize =parseFloat(textsize)-1;
	}
}

function fsizer(){
	fsize(textsize,'px','content_right_left');
	fsize(textsize,'px','content_right_left_large');
}

function fsize(size,unit,id){
	var vfontsize = document.getElementById(id);
	if(vfontsize){
		vfontsize.style.fontSize = size + unit;
		createCookie("textsizestyle", textsize, 365);
	}
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}