
	// check the browser type and set window features accordingly

	if (navigator.appName == 'Netscape'){
		var sFeatures = 'height=380,width=500,resizable=yes,screenX=0,screenY=0,scrollbars=yes';
		var sFeatures = 'height=380,width=500,resizable=yes,screenX=0,screenY=0,scrollbars=yes';
	} else {
		var sFeatures = 'height=380,width=500,resizable=yes,left=0,top=0,scrollbars=yes';
		var sFeatures = 'height=380,width=500,resizable=yes,left=0,top=0,scrollbars=yes';
	}


	// open popup and display file

	function showFile(p_sLocation)
	{
        //alert(p_sLocation);
        p_sLocation = p_sLocation.replace("\\","/")
      // prompt("",p_sLocation);
		window.open (p_sLocation,'popup',sFeatures);
	}

	function showSearchFile(p_sLocation)
	{
	        //alert (G_HOST + '/webservices/searchproxy.asp\?' + p_sLocation);
		//window.location = G_HOST + '/webservices/searchproxy.asp\?' + p_sLocation;
		window.open (G_HOST + '/webservices/searchproxy.asp\?' + p_sLocation,'popup',sFeatures);
		//window.location = '/default.asp?' + p_sLocation;
		//window.open ('/webservices/searchproxy.asp\?' + p_sLocation,'popup',sFeatures);
	}

	// open popup and display file

	function showFileNoLoc(p_sLocation)
	{
		window.open (p_sLocation,'popup',sFeatures_noLoc);
	}


	// set the text in the window status line - don't forget to return true!

	function setStatus(p_sMessage)
	{
		window.status = p_sMessage;
		return true;
	}


	// clear the text in the window status line - don't forget to return true!

	function clearStatus()
	{
		window.status = '';
		return true;
	}


	// show print-friendly version of the current page
	function showPrintFriendly_old()
	{
		var sLocation = G_HOST + '/ws/searchproxy.asp' + window.location.search + '&amp;print=y';
		showFile (sLocation);
		// showFile (sLocation.replace(/default.asp/i,'SearchProxy.asp'));
	}

	function showPrintFriendly(sSourceDB)
	{
		var sURL =  window.location.search
		if (sURL.indexOf('function') < 0 ){
		     var productid = document.frmRPBag.hdProductID.value
		     sURL += '&function=GetProduct&ProductID=' +productid   + '&PestGenie=Y&CompanyID=0&Details=Y&MasterTypeID=0' 

		}
		var sLocation = G_HOST + '/webservices/searchproxy.asp' + sURL  + '&amp;print=y';
		showFile (sLocation);

		//var sLocation = G_HOST + '/ws/searchproxy.asp' + window.location.search + '&amp;print=y&amp;SourceDB='+ sSourceDB;
		//showFile (sLocation);
		// showFile (sLocation.replace(/default.asp/i,'SearchProxy.asp'));
	}

	function checkProductName()
	{
		if (document.frmSearch.ProductName.value=='')
		{
			alert ('You must enter a partial or full name to search on');
			return false;
		}

		return true;
	}

	function showPermit(p_sLocation)
	{
		showFile (p_sLocation);
	}

	function showDoc(p_sLocation)
	{
		showFile (p_sLocation);
	}

	function showRPDoc(p_sLocation, p_iProductID, p_sProductName)
	{
        //update recent products as well
	   //	alert (sFldDelimiter);
		showFile (p_sLocation);
        //call back function in objRcnProd
        if (sRequestor == undefined)
            sRequestor = 'PESTGENIE'
        if (sFldDelimiter == undefined)
            sFldDelimiter = "~^";
        if (sMemberID == undefined)
            sMemberID = "-1"

        var inValue =  sRequestor + sFldDelimiter + p_iProductID+ sFldDelimiter + p_sProductName;

   		jsrsExecute("/cms_library/rmtcalls/rmtZipServer.asp", fCallBackRPBag, "getRmt" , Array( inValue, "add2RPBag", sMemberID));

	}

function showPest(p_sPestID)
	{
		showFile (G_HOST + '/search/pest.asp?PestID=' + p_sPestID);
	}

	function showSituation(p_sSituationID)
	{
		showFile (G_HOST + '/search/situation.asp?SituationID=' + p_sSituationID);
	}

	function emailDoc(p_sDocType,p_sProductID,p_sPestGenie)
	{
		showFile (G_HOST + '/md_mail/submit_em_pdfonly_popup.asp?file=' + p_sDocType + '&amp;ProductID=' + p_sProductID + '&amp;PestGenie=' + p_sPestGenie);
	}
	
	function faxDoc(p_sDocType,p_sProductID,p_sPestGenie,p_sFileName)
	{
		showFile (G_HOST + '/md_mail/submit_fax_pdfonly_popup.asp?file=' + p_sDocType + '&amp;ProductID=' + p_sProductID + '&amp;PestGenie=' + p_sPestGenie);
	}
	
	function emailDoc1_old(p_sDocType,p_sProductID,p_sPestGenie,p_pgdb)
	{
		showFile (G_HOST + '/md_mail/submit_em_pdfonly_popup1.asp?file=' + p_sDocType + '&amp;ProductID=' + p_sProductID + '&amp;PestGenie=' + p_sPestGenie+ '&amp;pgdb=' + p_pgdb);
	}

    function emailDoc1(p_sDocType,p_sProductID,p_sPestGenie,p_pgdb)
	{
		showFile (G_HOST + '/md_mail/submit_em_pdfonly_popup1.asp?file=' + p_sDocType + '&ProductID=' + p_sProductID + '&PestGenie=' + p_sPestGenie+ '&;pgdb=' + p_pgdb);
	}

	function faxDoc1(p_sDocType,p_sProductID,p_sPestGenie,p_pgdb)
	{
		showFile (G_HOST + '/md_mail/submit_fax_pdfonly_popup1.asp?file=' + p_sDocType + '&amp;ProductID=' + p_sProductID + '&amp;PestGenie=' + p_sPestGenie+ '&amp;pgdb=' + p_pgdb);
	}

	function checkFileCount()
	{

		var iSelected=0;
		var oForm = document.forms['zipandmail'];

		var oFiles = oForm.elements['SelectedFile'];

		for (var iFile=0; iFile<oFiles.length; iFile++)
		{
			if (oFiles[iFile].checked) {iSelected++}
		}

		if (iSelected==0)
		{
			alert ('Please select files for zipping by checking the box next to the product.');
			return false;
		}

		if (iSelected > 10)
		{
			alert ('A maximum of 10 files can be selected');
			return false;
		} else {
			return true;
		}

        //aif validate input values   to check for blind sql/xpath attacks
        var chks = document.getElementsByTagName('input')
//        document.forms['zipandmail'].[function].value ="zipandmail"
        for (var i=0; i< chks.length; i++){
            if (chks[i].name.indexOf('cbZip') > -1){
                chks[i].value = "on"
            }
        }
	}
	
	function checkEmailAddress()
	{
		var oForm = document.forms['zipandmail'];
		var oEmail = oForm.EmailAddress;
		
		if (oEmail.value==' ' || oEmail.value=='' || oEmail.value.length==0)
		{
			alert ('Please enter an email address');
			return false;
		} else {
			return true;
		}
	
	}
	function showPhoto(iPhotoID)
	{	
		//alert(iPhotoID);
	  //window.open ('showPhoto.asp?pUrl=' + sUrl + '&pFirstName=' + sFirstName.replace('&','and') + '&pSurname='+sSurname + '&pLocation='+sLocation+ '&pState='+sState+ '&pYear='+sYear,'_popup','left=1,top=1,height=500,width=400,toolbar=no,location=no,menubar=no');		
		window.open ('edit/showPhoto.asp?pPhotoID=' + iPhotoID ,'_popup','left=1,top=1,height=600,width=800,toolbar=no,location=no,menubar=no,scrollbars,resizable');
	}
	function showCDPhoto(iPhotoID)
	{	
		window.open ('edit/showPhoto.asp?pPhotoID=' + iPhotoID ,'_PhotoShow','left=1,top=1,height=660,width=500,toolbar=no,location=no,menubar=no,scrollbars,resizable');
	}
	function editPhoto(iPhotoID)
	{	
		window.open ('edit/editPhotoDetails.asp?pPhotoID=' + iPhotoID ,'_PhotoEdit','left=1,top=1,height=600,width=640,toolbar=no,location=no,menubar=no,scrollbars,resizable');
	}
	function submitPDFForm(){
		alert("pdf");
	/*
	var xObj = oFrm;
	var strAa = ""
	for (aa in xObj){
	if (xObj[aa]){
		strAa += aa +'='+ xObj[aa] + '\n';
	}
	}
	alert(strAa);
	//*/
	//alert(document.frmPDFResults("ReportName").value);
		//use rates + cc
		//document.frmPDFResults.action = '/webservices/PDFPestInSit.asp';

		//pest situation + cc
		//document.frmPDFResults.action = '/webservices/createPDFResults.asp';

		//product details
		//document.frmPDFResults.action = '/webservices/createPDFResults_040804.asp';

		//pest all situations
		//document.frmPDFResults.action = '/webservices/createPDFResults_040809.asp';

		//document.frmPDFResults.action = '/webservices/outlineTest.asp';

		document.frmPDFResults.action = '/webservices/' + document.frmPDFResults["ReportName"].value;

		document.frmPDFResults.submit();
		//window.open (G_HOST + '/webservices/acreatePDFResults.asp','PDFResults','left=1,top=1,height=660,width=410,toolbar=no,location=no,menubar=no,scrollbars');						
	}

	function onSubmitPDF(oForm){
		//alert(document.frmPDFResults("ReportName").value);
		oForm.action = '/webservices/' + oForm["ReportName"].value;
		oForm["PDFName"].value = oForm["ReportName"].options[oForm["ReportName"].selectedIndex].text;
		//alert(oForm("ReportName").options[oForm("ReportName").selectedIndex].text);
	}
	function onSubmitPDF_old(){
		//alert(document.frmPDFResults("ReportName").value);
		document.frmPDFResults.action = '/webservices/' + document.frmPDFResults("ReportName").value;
	}

	function checkSubmitPDF(oCBElement){
		//if one or more check boxes are ticked enable Submit button
		//alert(oCBElement.name);

		var bCbChecked = false;
		if (oCBElement.name.substring(0,8) == "cbForPDF") {
				if (oCBElement.checked == true){
					bCbChecked = true;
                    document.forms["frmPDFResults"]["selectedProducts"].value += oCBElement.value + ",";
                }
                else
                {
                    var re = eval("/" + oCBElement.value + "/g");
                    document.forms["frmPDFResults"]["selectedProducts"].value = document.forms["frmPDFResults"]["selectedProducts"].value.replace(re,"");
				}
                //alert(document.forms["frmPDFResults"]["selectedProducts"].value);
		}
		if (bCbChecked){
			//oForm.submitPDF.disabled = false;
            document.getElementById("submitPDF").disabled = false;
		}else{
			//oForm.submitPDF.disabled = true;
            document.getElementById("submitPDF").disabled = true;
		}
	}
	function checkSubmitPDF_old070219(oFormElement){
		//if one or more check boxes are ticked enable Submit button
		//alert(oFormElement.name);
	/*
	var xObj = oFormElement.form;
	var strAa = ""
	for (aa in xObj){
	if (xObj[aa]){
		strAa += aa +'='+ xObj[aa] + '\n';
	}
	}
	alert(strAa);
	//*/

		var bCbChecked = false;
		var oForm = oFormElement.form;
		for (var ii=0 ; ii< oForm.length; ii++) {
			if (oForm.elements[ii].name.substring(0,8) == "cbForPDF") {
				if (oForm.elements[ii].checked == true){
					bCbChecked = true;
				}
			}
		}
		if (bCbChecked){
			oForm.submitPDF.disabled = false;
		}else{
			oForm.submitPDF.disabled = true;
		}
	}
	function checkSubmitPDF_old1(oForm){
		//if one or more check boxes are ticked enable Submit button
	///*
	var xObj = oForm;
	var strAa = ""
	for (aa in xObj){
	if (xObj[aa]){
		strAa += aa +'='+ xObj[aa] + '\n';
	}
	}
	alert(strAa);
	//*/

		var bCbChecked = false;
		//var oForm = document.forms['frmPDFResults'];
		for (var ii=0 ; ii< oForm.length; ii++) {
			if (oForm.elements[ii].name.substring(0,8) == "cbForPDF") {
				if (oForm.elements[ii].checked == true){
					bCbChecked = true;
				}
			}
		}
		if (bCbChecked){
			oForm.submitPDF.disabled = false;
		}else{
			oForm.submitPDF.disabled = true;		
		}
	}
	function checkSubmitPDF_old(){
		//if one or more check boxes are ticked enable Submit button
		
		var bCbChecked = false;
		var oForm = document.forms['frmPDFResults'];		
		for (var ii=0 ; ii< oForm.length; ii++) {	
			if (oForm.elements[ii].name.substring(0,8) == "cbForPDF") {							
				if (oForm.elements[ii].checked == true){			
					bCbChecked = true;
				}	
			}
		}
		if (bCbChecked){
			oForm.submitPDF.disabled = false;
		}else{
			oForm.submitPDF.disabled = true;		
		}
	}
