function ShowHideLayers(obj,visStr,color,loc) {							//Display the help layers
	var i, theObj, NS=(navigator.appName=='Netscape');
	if (color == 'blue') color = '#A9CBE6'
	else if (color == 'green') color = '#A9DBBD'
	if (navigator.appName == 'Netscape' && document.layers != null) {	//Netscape
		var objstr = 'document.layers[\''+obj+'\']';
		theObj = eval(objstr);
		if (theObj) {
			theObj.visibility = visStr;
			theObj.style.left = 80;
			theObj.style.top = loc;
			theObj.style.background = color;
		}
	} else if (document.all != null) { //IE
		if (visStr == 'show') visStr = 'visible'; //convert parameter
		if (visStr == 'hide') visStr = 'hidden';
		var objstr = 'document.all[\''+obj+'\']';
		theObj = eval(objstr);
		if (theObj) {
			theObj.style.visibility = visStr;
			theObj.style.left = 80;
			theObj.style.top = loc;
			theObj.style.background = color;
		}
	}
	return false;
}

var myimage;
function rollbutton(img,state) {
	myimage = new Image();
	myimage.src = "Picture/button/"+img +"_"+ state + '.jpg'
	document.images[img].src = eval('myimage.src');
}

function swapbutton (imgobj, img, state) {
	imgobj.setAttribute("src","Picture/button/"+img +"_"+ state + '.jpg');
}

function roll(img,state) {
	myimage = new Image();
	myimage.src = img + state + '.jpg'
	document.images[img].src = eval('myimage.src');
}

function rollm (img,state,message) {
	myimage = new Image();
	myimage.src = img + state + '.jpg'
	document.images[img].src = eval('myimage.src');
}

function popUp(url, wID, hSize, vsize, showb) {
    window.open(url, wID, "width=" + hSize + ",height=" + vsize + ",toolbar=" + showb + ",location=no,menubar=no,directories=no,status=no,scrollbars=yes,resizable=yes,alwaysRaised=yes,z-lock=yes" );
    return false;
}

function showmessage(msg)
{ 
	window.status = msg;
	setTimeout("nomessage()",3000); 
} 

function nomessage()
{ 
	window.status=""; 
} 

//Count the checking box
function counting(myform) {
	var checkboxcount;
	checkboxcount = 0;
	for (counter = 0; counter < myform.productlisting.length; counter++)
	{
		if (myform.productlisting[counter].checked)
			{ checkboxcount = checkboxcount + 1; }
	}	
}

function tableform (tdObj, bgcolor) {
	tdObj.bgColor = bgcolor;
}

function getpage () {										//get the query string
	page = 0
	var x = 0
	page = location.search.substr(1).split("?")
	//for (x=0;x<=page.length;x++) {
		eval(page)
	//}
	page = escape(page);
	page = page.slice(7);
	return page;
}

function getarg () {										//get the query string
	var arg, x = 0, argarray, temparg;
	arg = location.search.substr(1).split("?")
	argarray = (new String(arg)).split("&");
	for (x=0;x<argarray.length;x++) {
		temp = (argarray[x]).split("=");
		temp[1] = temp[1].replace("%20"," ");
		temparg = temp[0]+'='+'"'+temp[1]+'"';
		eval(temparg);
	}
	return argarray;	
}


function setButton (name, vis) {
	var obj = null;
	if (document.getElementById)
		obj = document.getElementById(name);
	if (document.all)
		obj = document.all(name);
	if (obj!=null)
		swapbutton(obj,name,vis);
}

function refreshButton (menuitem) {
	for (var i=0; i<menuitem.length; i++) {
		setButton (menuitem[i], 'up');
	}
}

//preload image
function preloadImage (menuitem, path) {
	for (var i=0; i<menuitem.length; i++) {
		var image1 = new Image();
		image1.src = path+"Picture/button/"+menuitem+"_down.jpg";
	}
}

function createRequestObject() {
  FORM_DATA = new Object();
    // The Object ("Array") where our data will be stored.
  separator = ',';
    // The token used to separate data from multi-select inputs
  query = '' + this.location;
  qu = query
    // Get the current URL so we can parse out the data.
    // Adding a null-string '' forces an implicit type cast
    // from property to string, for NS2 compatibility.
  query = query.substring((query.indexOf('?')) + 1);
    // Keep everything after the question mark '?'.
  if (query.length < 1) { return false; }  // Perhaps we got some bad data?
  keypairs = new Object();
  numKP = 1;
    // Local vars used to store and keep track of name/value pairs
    // as we parse them back into a usable form.
  while (query.indexOf('&') > -1) {
    keypairs[numKP] = query.substring(0,query.indexOf('&'));
    query = query.substring((query.indexOf('&')) + 1);
    numKP++;
      // Split the query string at each '&', storing the left-hand side
      // of the split in a new keypairs[] holder, and chopping the query
      // so that it gets the value of the right-hand string.
  }
  keypairs[numKP] = query;
    // Store what's left in the query string as the final keypairs[] data.<
  for (i in keypairs) {
    keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
      // Left of '=' is name.
    keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
      // Right of '=' is value.
    while (keyValue.indexOf('+') > -1) {
      keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
        // Replace each '+' in data string with a space.
    }
    keyValue = unescape(keyValue);
      // Unescape non-alphanumerics
    if (FORM_DATA[keyName]) {
      FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
        // Object already exists, it is probably a multi-select input,
        // and we need to generate a separator-delimited string
        // by appending to what we already have stored.
    } else {
      FORM_DATA[keyName] = keyValue;
        // Normal case: name gets value.
    }
  }
  return FORM_DATA;
}
FORM_DATA = createRequestObject();