<!--

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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function showPop(url,name,width,height) {
	window.open(url,name,"resizable=no,scrollbars=no,status=no,location=no,menubar=no,toolbar=no,width="+width+",height="+height);
}

// AJAX FUNCTIONS
function getXMLHTTP()
 {
 	try {
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	} catch(ex) {
		//either this is not IE, or it is a version of IE which does not support XMLHTTP
		var notIECompatibleXMLHTTP=true;
	}
	if (notIECompatibleXMLHTTP==true) {
		try {
			request_o = new XMLHttpRequest();
		} catch(ex) {
			//we can't use AJAX because this browser is not compatible.
			request_o = false;
		}
	}

	return request_o;
}

var responseObjectId = null;		// the id of the object to receive the response data
var useCustomFn = false;			// use a custom function to process the results - calling page must have function: processResults(response)
var showLoading = false;			// whether to display the loading div
function sendAjaxRequest(url,objId,loading,customFn) {
		responseObjectId = objId;
		useCustomFn = customFn;
		showLoading = loading;
		
		if (showLoading)
			toggleLayer('loading',true);
			
		if (document.getElementById(responseObjectId)) {
			http = getXMLHTTP();
			if (http) {
				http.open('get',  url);
				http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
				/* Define a function to call once a response has been received. This will be our
					handleProductCategories function that we define below. */
				http.onreadystatechange = receiveAjaxResponse;
				/* Send the data. We use something other than null when we are sending using the POST
					method. */
				http.send(null);
			} else {
				alert("xmlHTTP cannot be created");
			}
		} else {
			alert("responseObject not found");
		}
}

function receiveAjaxResponse() {
	if (http.readyState == 4){ //Finished loading the response
		/* We have got the response from the server-side script,
			let's see just what it was. using the responseText property of
			the XMLHttpRequest object. */
		var response = http.responseText;
		/* And now we want to change the product_categories <div> content.
			we do this using an ability to get/change the content of a page element
			that we can find: innerHTML. */
			//alert(response);
		if (!useCustomFn) {
			document.getElementById(responseObjectId).value = response;
			//alert(response);
		} else {
			processResults(response);		// this function must exist in the calling page
		}
		
		if (showLoading)
			toggleLayer('loading',false);
	}
}

function numericOnly(myfield, e, dec)
{
	var key;
	var keychar;

	if (window.event)
 		key = window.event.keyCode;
	else if (e)
 		key = e.which;
	else
 		return true;

	keychar = String.fromCharCode(key);
	// control keys
	if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) )
 		return true;
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
 		return true;
	// decimal point jump
	else if (dec && (keychar == "."))
 	{
 		myfield.form.elements[dec].focus();
 		return false;
 	}
	else
 		return false;
}
//-
function alphaNumericOnly(myfield, e, doc)
{
	if (!numericOnly(myfield,e,doc)) {
		return (("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").indexOf(keychar) > -1);		
	}
}

function increaseFontSize() {
	var bodyMain = document.getElementById('body_main');
	bodyMain.style.fontSize = '12px';
} 

function decreaseFontSize() {
	var bodyMain = document.getElementById('body_main');
	bodyMain.style.fontSize = '10px';
}

function toggleLayer(whichLayer,on) {
  	var elem, vis;
  	if (document.getElementById) // this is the way the standards work
    	elem = document.getElementById(whichLayer);
  	else if (document.all) // this is the way old msie versions work
      elem = document.all[whichLayer];
  	else if (document.layers) // this is the way nn4 works
    	elem = document.layers[whichLayer];
  	vis = elem.style;
  	// if the style.display value is blank we try to figure it out here
//  	if (vis.display=='' && elem.offsetWidth != undefined && elem.offsetHeight != undefined)
//    	vis.display = (elem.offsetWidth != 0 && elem.offsetHeight != 0) ? 'block' : 'none';
//  	vis.display = (vis.display == '' || vis.display == 'block') ? 'none' : 'block';
	vis.display = (on ? 'block' : 'none');
}

function highlightRow(rowId,sclass) {
	if (document.getElementById(rowId))
		document.getElementById(rowId).className = sclass;
}

var submitting = false;
function isSubmitting(btn) { 
	if (!submitting) { 
		submitting = true;
		if (document.getElementById(btn)) {
			document.getElementById(btn).className = 'buttonDisabled';
		}
		return true;
	} else {
		return false;
	}
} 

// ------------------- Floating Layer at Cursor Position 
// http://bontragerconnection.com/ and http://www.willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; } 
function AssignPosition(d) {
	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
	}
	else if(document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
	} 
	else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
	}
	if(document.all) {
		cX += rX; 
		cY += rY; 
	}
	d.style.left = (cX+10) + "px";
	d.style.top = (cY+10) + "px";
}
function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none"; 
}
function ShowContent(d,helpIdx) {
	if(d.length < 1) { return; }
	var h = document.getElementById('fieldHelp');
	h.innerHTML = arrHelp[helpIdx];
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block"; 
}
function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if(dd.style.display == "none") { dd.style.display = "block"; }
	else { dd.style.display = "none"; }
}

function getRadioValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function setRadioValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}


-->
