	function showPicDisplay(inPic){
		//show clicked image in picDisplay (classifieds)
		var vPic = inPic
		var vImg = document.getElementById("picDisplay")
		if (vImg!=null){vImg.src=vPic}
	}
	
    function gmLoad(vLat, vLng, vName) {
		var gsMap = document.getElementById("gsMap")
		if (gsMap!=null && GBrowserIsCompatible()){
			var map = new GMap2(gsMap);
			var point = new GLatLng(vLat, vLng);
			var marker = new GMarker(point);
			map.setCenter(point, 12);
			map.addOverlay(marker);
			if (!(vName==''||vName==null)){marker.openInfoWindowHtml(vName)};
			map.addControl(new GSmallMapControl());
		}
    }

	function gsX(inHttp, inXtra){
		//quick launch for gpX to avoid payload of added vars
		var vHttp = inHttp
		var vXtra = inXtra
		gpX('div','godSpace',vHttp,vXtra)	
	}

	function isIframe(){
		//run in onload to set whether to display header.asp
		var vHdr = document.getElementById("header")
		if (vHdr!=null){
			if (parent.frames.length!=0){
				vHdr.style.display="none"
				setCookie('showH',0,1)
			} else {
				vHdr.style.display="block"		
				setCookie('showH',1,1)				
			}
		}
	}
	
	function gsGrow(inSize){
		var gsGrowImg	= document.getElementById('gsGrowImg')
		var gsSpace 	= document.getElementById('godSpace')
		var gsContent 	= document.getElementById('gsContent')
		var gsSubTable 	= document.getElementById('gsSubTable')
		
		if (gsSpace!=null){
			if (parseInt(gsSpace.style.height)>300 || inSize==0){
				if (gsGrowImg!=null){gsGrowImg.src = '/mod/global/img/icons16x16/silk/arrow_out.png'}
				if (gsSubTable!=null){gsSubTable.style.width = '100%'}
				if (gsSpace!=null){gsSpace.style.height = '290px'}
				if (gsContent!=null){
					gsContent.style.height = '235px';
					gsContent.style.overflow = 'hidden';
				}
			} else {
				if (gsGrowImg!=null){gsGrowImg.src = '/mod/global/img/icons16x16/silk/arrow_in.png'}
				if (gsSubTable!=null){gsSubTable.style.width = '92%'}
				if (gsSpace!=null){gsSpace.style.height = '412px'}
				if (gsContent!=null){
					gsContent.style.height = '362px';
					gsContent.style.overflow = 'auto';
				}
			}
		}
	}

	function onChangeNetwork(inNetwork){
		//change network affiliate from header.asp ddl
		var vHost 	= inNetwork
		var vUrl	= new String(document.location)
		var vHost2 	= new String(location.host)
		document.location = vUrl.replace(vHost2, vHost)
	}

	function isUniqueLogin(inValue){
		//checks if login (email) is unique [create.asp]
			var vValue = inValue;
			var x = gpX(1,'isUniqueLoginMsg','/login/ajx/unique.asp?e='+vValue);
		}
		
	function isUniqueLoginMsg(inCode){
		//display message result of isUniqueLogin()
		var vCode = inCode
		var vDiv = document.getElementById("uniqueMsg")
		var vBtn = document.getElementById("createSubmit")
		if (vBtn==null) {vBtn = document.getElementById("editSubmit")}
		if (vCode==0 && vDiv!=null){
			vDiv.innerHTML = "gPlus login already exists!<br/><span style='color:#000000;'>Re-enter, <a href='/login'>Sign-In</a> or <a href='/login/forgot.asp'>Reset</a> your password.</span>";
//			if (vBtn=="createSubmit") {
//				vDiv.innerHTML = "Account login already exists!<br/><span style='color:#000000;'>Re-enter, <a href='/login'>Sign-In</a> or <a href='/login/forgot.asp'>Reset</a> your password.</span>";
//			}else{
//				vDiv.innerHTML = "Account login already exists!<br/><span style='color:#000000;'>Please enter a different email address.";
//			}
			vDiv.style.display = "block";
			if (vBtn!=null){vBtn.disabled = true;}
		} else {
			vDiv.style.display = "none";
			if (vBtn!=null){vBtn.disabled = false;}
		}	
		return false;
	}

    var existsAdminObj
	function isExistingLogin(inThis){
		//checks if login (email) is unique [create.asp]
	    var vValue = inThis.value;
	    existsAdminObj = inThis;
			if (vValue!=""){
			    var x = gpX(1, 'isExistingLoginMsg', '/login/ajx/unique.asp?e=' + vValue);
			}
		}
		
	function isExistingLoginMsg(inCode){
		//display message result of isExistingLogin()
	    var vCode = inCode
		var vDiv = document.getElementById("uniqueMsg")
		var vBtn = document.getElementById("transferSubmit")
		if (vCode!=0 && vDiv!=null){
			//vDiv.innerHTML = "Email address does not exist!<br/><span style='color:#000000;'>Please enter a different email address.";
			//vDiv.style.display = "block";
		    //vBtn.disabled = true;
		    alert("Email address (" + existsAdminObj.value + ") does not exist!\nPlease enter a different email address.")
		    existsAdminObj.value = ""
		} else {
			vDiv.style.display = "none";
			vBtn.disabled = false;
		}	
		return false;
	}



	function isExistingPromo(inValue){
		//checks if login (email) is unique [affSetup.asp]
			var vValue = inValue;
			var x = gpX(1,'isExistingPromoMsg','/gp/ajx/promoCheck.asp?p='+vValue);
		}
		
	function isExistingPromoMsg(inCode){
		//display message result of isExistingPromo()
		var vCode = inCode
		var vDiv = document.getElementById("promoMsg")
		if (vCode==0 && vDiv!=null){
			vDiv.innerHTML = "Promo code does not exist!<br/><span style='color:#000000;'>Please check your entry.";
			vDiv.style.display = "block";
		} else {
			vDiv.style.display = "none";
		}	
		return false;
	}



	
	function textCounter(field,inMsgDiv) {
		maxlimit = field.getAttribute("gpChars");
		if (field.value.length > maxlimit) // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
		else // otherwise, update 'characters left' counter
				if (document.all || document.getElementById) {
				var ncl = document.getElementById(inMsgDiv);
				ncl.innerHTML = maxlimit - field.value.length;
				}
	} // end of textCounter	
	
	
	function wordCounter(field,inMsgDiv,inShowAlert){
		var y=field.value;
		maxlimit = field.getAttribute("gpWords");
		var r = 0;
		var vSpecChars = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\.|\s/g;


		y=y.replace(vSpecChars,',');
		a=y.split(',');
	
		for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}

		if (r > maxlimit) {
			a=y.split(',',maxlimit);
			if (inShowAlert == 1){
				alert('You are only allowed ' + maxlimit + ' keywords.')
			}
			field.value = a.join(',');
			r = maxlimit;
		}
				
		if (document.all || document.getElementById) {
			var ncl = document.getElementById(inMsgDiv);
			ncl.innerHTML = maxlimit - r;
		}

	}  // end of wordCounter	


	function levelCheck(field) {

		vSelLevel = getSelectedRadioValue(field)
		//alert(vSelLevel)		
		switch(vSelLevel)
		{
			case "100":
				document.getElementById('frmDiv1').style.display="none"
				document.getElementById('frmDiv2').style.display="none"
				document.getElementById('frmDiv3').style.display="none"
				document.getElementById('frmDiv4').style.display="none"
				break    

			case "200":
				document.gpf_ent.gpf_keywords.setAttribute('gpWords',5);
				document.gpf_ent.gpf_description.setAttribute('gpChars',150);
				updateCounts()

				document.getElementById('frmDiv1').style.display="none"
				document.getElementById('frmDiv2').style.display="none"
				document.getElementById('frmDiv3').style.display="block"
				document.getElementById('frmDiv4').style.display="none"
				break

			case "300":
				document.gpf_ent.gpf_keywords.setAttribute('gpWords',20);
				document.gpf_ent.gpf_description.setAttribute('gpChars',500);
				updateCounts()

				document.getElementById('frmDiv1').style.display="block"
				document.getElementById('frmDiv2').style.display="block"				
				document.getElementById('frmDiv3').style.display="block"
				document.getElementById('frmDiv4').style.display="block"
				break
		}	
		
	} // end of levelCheck	


function updateCounts() {
	wordCounter(eval('document.gpf_ent.gpf_keywords'),'numwordsleft',0)
	textCounter(eval('document.gpf_ent.gpf_description'),'numcharleft')
}


function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function

function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function


function hideall(inId,inSpan)
{
	var locl = document.getElementsByTagName('tbody');
	for (i=0;i<locl.length;i++)
	{
		if (locl[i].id != inId && locl[i].id.substr(0,2) == 'tb')
		{
			locl[i].style.display='none';
		}
	}

	var locl = document.getElementsByTagName('span');
	for (i=0;i<locl.length;i++)
	{
		if (locl[i].id != inSpan && locl[i].id.substr(0,3) == 'spc')
		{
			document.getElementById(locl[i].id).innerHTML='<img src=/mod/global/img/icons16x16/plus.gif>';
			vSpanExp = locl[i].id.replace('spc','spe');
			document.getElementById(vSpanExp).style.display = 'none';
		}
	}


}

function showHideExp(inClass, inSpan){
	var arrElements = document.getElementsByTagName("tr");
	for(var i=0; i<arrElements.length; i++){
		if(arrElements[i].className==inClass){
			if (arrElements[i].style.display == ''){
				arrElements[i].style.display = 'none';
				document.getElementById(inSpan).innerHTML='show expired';
			}else{
				arrElements[i].style.display = '';
				document.getElementById(inSpan).innerHTML='hide expired';
			}
		}
	}
}


function showHideTbody(inTbody, inSpan){
	vSpanExp = inSpan.replace('spc','spe')
	ELpntr=document.getElementById(inTbody);
	if (ELpntr.style.display == ''){
		ELpntr.style.display = 'none';
		document.getElementById(inSpan).innerHTML='<img src=/mod/global/img/icons16x16/plus.gif>';
		document.getElementById(vSpanExp).style.display = 'none';
	}else{
		ELpntr.style.display = '';
		document.getElementById(inSpan).innerHTML='<img src=/mod/global/img/icons16x16/minus.gif>';
		document.getElementById(vSpanExp).style.display = '';
	}
}

	function onChangeView(inView){
		//change view of admin items
		document.location = inView
	}



	
	function isNumberKey(evt){
		var charCode = (evt.which) ? evt.which : event.keyCode
		if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
		return true;
	}


