
    function submitForm(frmtoSubmit){
        if(frmtoSubmit){
            frmtoSubmit.submit();
        }
    }
    function submitFormName(frmtoSubmit){
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id==frmtoSubmit){
                document.forms[i].submit();
            }
        }
    }
    
    function performsearch(){
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmmainsearch'){
                document.forms[i].submit();
            }
        }
    }
    function refreshpage(frmtosubmit,type){
         for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id==frmtosubmit){
                    myform = document.forms[i];
            }
        }
        mybtn = document.getElementById("hdsecurelogin");
        if(mybtn){
            mybtn.value=type;
        }
        if(type==2){
	        myform.logout.value="dologout";
        }
        if(myform){
            myform.submit();
        }
    }

	function SubmitEnter(e,frmtosubmit,functiontocall){
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;

		if (keycode == 13)
		{
            if(frmtosubmit){
                eval(functiontocall);
            } 
		   return false;
		}
		else
		{
			return true;
		}
    }	
    
    function doConfirm(frmToSubmit){
        window.open("popup.htm","","width=150,height=50,toolbar=no,menubar=no");
    }
    var winConfirm = null;
    var winConfirm1 = null;
    var winConfirm2 = null;
    var winConfirm3 = null;
    
    function showQuoteConfirm(){
      var windowWidth = 250;
      var windowHeight = 100;
      var locX = ( screen.width - windowWidth ) / 2;
      var locY = ( screen.height - windowHeight ) / 2;
      var windowFeatures = "width=" + windowWidth
                         + ",height=" + windowHeight
                         + ",screenX=" + locX
                         + ",screenY=" + locY
                         + ",left=" + locX
                         + ",top=" + locY;
    
      /* Close window first to make sure that our window has */
      /* the desired features */
    
      if ( ( winConfirm != null )
        && !winConfirm.closed )
      {
        winConfirm.close();
      }
    
      /* Open the new confirm */
      winConfirm = open( "", "winConfirm", windowFeatures );
    
      /* Write to the confirm box */
      var theHTML = '<HEAD><TITLE>Please choose...</TITLE>'
                + '<style>'
                + 'body {'
                + '	font-family: Verdana, Arial, Helvetica, sans-serif;'
                + '	font-size: 8.5pt;'
                + '	font-style: normal;'
                + '	line-height: normal;'
                + '	font-weight: normal;'
                + '	font-variant: normal;'
                + ' margin: 0px;'
                + '	padding: 0px;'
                + '}'
                + '</style>' 
                + '</HEAD>'
                + '<BODY BGCOLOR="#FFFFFF">'
                  + '<br><CENTER><B>'
                  + 'Would you like a quote for the product you are viewing ?'
                  + '</B><FORM NAME="buttonForm">'
                  + '<INPUT TYPE="button" VALUE=" Yes  "'
                  + ' ONCLICK="opener.buttonClicked(1,0);self.close();">'
                  + '&nbsp;'
                  + '<INPUT TYPE="button" VALUE="  No  "'
                  + ' ONCLICK="opener.showSelectConfirm();self.close();">'
                  + '</FORM></BODY>';
    
      winConfirm.document.writeln( theHTML );
    }
    
    function showSelectConfirm(){
      var windowWidth = 250;
      var windowHeight = 110;
      var locX = ( screen.width - windowWidth ) / 2;
      var locY = ( screen.height - windowHeight ) / 2;
      var windowFeatures = "width=" + windowWidth
                         + ",height=" + windowHeight
                         + ",screenX=" + locX
                         + ",screenY=" + locY
                         + ",left=" + locX
                         + ",top=" + locY;
    
      /* Close window first to make sure that our window has */
      /* the desired features */
    
      if ( ( winConfirm1 != null )
        && !winConfirm1.closed )
      {
        winConfirm1.close();
      }
    
      /* Open the new confirm */
      winConfirm1 = open( "", "winConfirm1", windowFeatures );
      
      /* Write to the confirm box */
      var theHTML = '<HEAD><TITLE>Please choose...</TITLE>'
                    + '<style>'
                    + 'body {'
                    + '	font-family: Verdana, Arial, Helvetica, sans-serif;'
                    + '	font-size: 8.5pt;'
                    + '	font-style: normal;'
                    + '	line-height: normal;'
                    + '	font-weight: normal;'
                    + '	font-variant: normal;'
                    + ' margin: 0px;'
                    + '	padding: 0px;'
                    + '}'
                    + '</style>'   
                    + '</HEAD>'
                  + '<BODY BGCOLOR="#FFFFFF">'
                  + '<br><CENTER><B>'
                  + 'Would you like a quote for products or an integrated system ?'
                  + '</B><FORM NAME="buttonForm">'
                  + '<INPUT TYPE="button" VALUE=" Products  "'
                  + ' ONCLICK="opener.buttonClicked(0,0);self.close();">'
                  + '&nbsp;'
                  + '<INPUT TYPE="button" VALUE="  System  "'
                  + ' ONCLICK="opener.buttonClicked(0,1);self.close();">'
                  + '</FORM></BODY>';
    
      winConfirm1.document.writeln( theHTML );
    }
    
    function showSystemConfirm(){
      var windowWidth = 250;
      var windowHeight = 100;
      var locX = ( screen.width - windowWidth ) / 2;
      var locY = ( screen.height - windowHeight ) / 2;
      var windowFeatures = "width=" + windowWidth
                         + ",height=" + windowHeight
                         + ",screenX=" + locX
                         + ",screenY=" + locY
                         + ",left=" + locX
                         + ",top=" + locY;
    
      /* Close window first to make sure that our window has */
      /* the desired features */
    
      if ( ( winConfirm2 != null )
        && !winConfirm2.closed )
      {
        winConfirm2.close();
      }
    
      /* Open the new confirm */
      winConfirm2 = open( "", "winConfirm2", windowFeatures );
    
      /* Write to the confirm box */
      var theHTML = '<HEAD><TITLE>Please choose...</TITLE>'
                    + '<style>'
                    + 'body {'
                    + '	font-family: Verdana, Arial, Helvetica, sans-serif;'
                    + '	font-size: 8.5pt;'
                    + '	font-style: normal;'
                    + '	line-height: normal;'
                    + '	font-weight: normal;'
                    + '	font-variant: normal;'
                    + ' margin: 0px;'
                    + '	padding: 0px;'
                    + '}'
                    + '</style>'   
                  + '  </HEAD>'
                  + '<BODY BGCOLOR="#FFFFFF">'
                  + '<br><CENTER><B>'
                  + 'Would you like Jiskoot to recommend the system components or would you like to select them ?'
                  + '</B><FORM NAME="buttonForm">'
                  + '<INPUT TYPE="button" VALUE=" Recommend  "'
                  + ' ONCLICK="opener.sendmessage(\'frmcalc\',0);self.close();">'
                  + '&nbsp;'
                  + '<INPUT TYPE="button" VALUE="  Select  "'
                  + ' ONCLICK="opener.sendmessage(\'frmcalc\',1);self.close();">'
                  + '</FORM></BODY>';
    
      winConfirm2.document.writeln( theHTML );
    }
    
    function showSystemConfirm1(){
      var windowWidth = 250;
      var windowHeight = 150;
      var locX = ( screen.width - windowWidth ) / 2;
      var locY = ( screen.height - windowHeight ) / 2;
      var windowFeatures = "width=" + windowWidth
                         + ",height=" + windowHeight
                         + ",screenX=" + locX
                         + ",screenY=" + locY
                         + ",left=" + locX
                         + ",top=" + locY;
    
      /* Close window first to make sure that our window has */
      /* the desired features */
    
      if ( ( winConfirm3 != null )
        && !winConfirm3.closed )
      {
        winConfirm3.close();
      }
    
      /* Open the new confirm */
      winConfirm3 = open( "", "winConfirm3", windowFeatures );
    
      /* Write to the confirm box */
      var theHTML = '<HEAD><TITLE>Please choose...</TITLE>'
                    + '<style>'
                    + 'body {'
                    + '	font-family: Verdana, Arial, Helvetica, sans-serif;'
                    + '	font-size: 8.5pt;'
                    + '	font-style: normal;'
                    + '	line-height: normal;'
                    + '	font-weight: normal;'
                    + '	font-variant: normal;'
                    + ' margin: 0px;'
                    + '	padding: 0px;'
                    + '}'
                    + '</style>'     
                  + '</HEAD>'
                  + '<BODY BGCOLOR="#FFFFFF">'
                  + '<br><CENTER><B>'
                  + 'Would you like a standard system or would you like to select the components ?'
                  + '</B><FORM NAME="buttonForm">'
                  + '<INPUT TYPE="button" VALUE=" Standard  "'
                  + ' ONCLICK="opener.sendmessage(\'frmQuote\',0);self.close();">'
                  + '&nbsp;'
                  + '<INPUT TYPE="button" VALUE="  Select  "'
                  + ' ONCLICK="opener.sendmessage(\'frmQuote\',1);self.close();">'
                  + '</FORM></BODY>';
    
      winConfirm3.document.writeln( theHTML );
    }
    
    function buttonClicked( buttonChoice,typechoice )
    {
        var objfrm;
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmQuote'){
                objfrm = document.forms[i];
            }
        }        
        if(objfrm){
            if(buttonChoice ==1 && objfrm.issystem.value==1){
                objfrm.technology.value=1;
                showSystemConfirm1();
            }else{    
                objfrm.prod.value=buttonChoice;
                objfrm.issystem.value=0;
                objfrm.technology.value=typechoice;
                objfrm.submit();
           }     
        }
    }
    
    function sendmessage(frmname, buttonChoice)
    {
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id==frmname){
                objfrm = document.forms[i];
            }
        }    
        objfrm.recommend.value=buttonChoice;
        objfrm.submit();
    }
    
    function msgConfirm(message){
		if (confirm (message))
			return true;
		else
			return false;
    }
    
    function validate_marineinput(objfrm){
        var bRetval = false;
        var app=0;var linesize=0;
        if(objfrm.application){
            app = objfrm.application.value;    
        }
        switch(app){
            case "1": // marine loading
                bRetval=true;
            break;
            case "2": // marine unoading
                //linesize=converttoinch(document.frmcalc.InternalDiamter.value);
                //if(linesize < 16){
                    if(converttom3(objfrm.minimumflowrate.value,"min",objfrm)>250){
                        return msgConfirm("Are you sure that your minimum flow rate low enough? In marine unloading applications the minimum flow rate is normally less than 250m3/hr when stripping and at start-up");
                    }else{
                        bRetval=true;
                    }
                //}else
                //    bRetval=true;
            break;
            case "3": //pipeline
                bRetval=true;
            break;
        }

        return bRetval;
    }
    
    function validate_vel(objfrm){
        bRetVal = false;
        try{
            var maxvel=0;
            var ID=0;
            ID = converttoinch(objfrm.InternalDiamter.value,objfrm);
            IntD = ID * 0.0254;
            maxvel = (converttom3(objfrm.maximumflowrate.value,"max",objfrm) / (900*Math.PI* Math.pow(IntD,2)));
            if(maxvel > 8){
                return msgConfirm("Are sure you maximum flow rate is low enough? The current velocity is higher than 8 m/s and this is high for this duty");
            }else{
                 bRetval=true;
            }
        }catch(e){
            bRetval=true;    
        }
        return bRetval;
    }
    
    function validate_minvis(objfrm){
        if(converttocst(objfrm.Viscosity.value,objfrm) < 1.5){
            return msgConfirm("Are you sure the viscosity is correct. This is a low viscosity and this will dramatically affect the natural mixing.");
        }else if(converttocst(objfrm.Viscosity.value,objfrm) >250){
            return msgConfirm("Are you sure the viscosity is correct. This is a high viscosity for this type of application.");
        }
        return true;    
    }
    
    function validate_density(objfrm){
        var SG = objfrm.API.value;
        if (SG < 10){
            SG = SG * 1000;                
        }else if (SG >= 10 && SG <= 100){
            SG = 141.5*1000/(131.5+SG);
        }
        if( SG < 650 || SG > 950){
            return msgConfirm("Are you sure the density is correct. Please check the figure entered.");
        }
        return true;
    }

    function converttoinch(pVal,objfrm){
        if(objfrm.internaldiametertype.value=="mm"){
            return pVal/25.4;
        }else
            return pVal;
    }

    function converttom3(pVal,pType,objfrm){
        var flowtype;
        if(pType=="min"){
            flowtype=objfrm.minflowratetype.value;
        }else if(pType=="max"){
            flowtype=objfrm.maxflowratetype.value;
        }
        if(flowtype=="bbl"){
            return pVal/6.2898108;
        }else{
            return pVal;
        }
    }
    
    function converttocst(pVal,objfrm){
        if(objfrm.viscositytype.value=="cp"){
            //var SG = document.frmcalc.API.value/1000;
            var SG = objfrm.API.value;
            if (SG >100){
                SG = SG /1000;                
            }else if (SG >= 10 && SG <= 100){
                SG = 141.5*1000/(131.5+SG);
            }
            return pVal/SG;
        }else
            return pVal;
    }
    function performcalc(){
        var bRetVal=false;
        var objfrm;
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmcalc'){
                objfrm = document.forms[i];
            }
        }
        if(objfrm){
            bRetVal =validate_marineinput(objfrm);
            if(bRetVal)
                bRetVal=validate_vel(objfrm);
            if(bRetVal)
                bRetVal=validate_minvis(objfrm);
            if(bRetVal)
                bRetVal=validate_density(objfrm);
            if(bRetVal){
                objfrm.submit();
            }
        }
    }
    
    function validateSelection(){
        var validator=false;
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmcalc'){
                objfrm = document.forms[i];
            }
        }
        if(objfrm){
            if(objfrm.elements['productid[]']){
                if(objfrm.elements['productid[]'].length){//more than one product
                    var element =  objfrm.elements['productid[]'];   
                    for(var i=0;i<element.length;i++){
                        var quantityname = "quantity" + element[i].value;
                        var quantityelement = objfrm.elements[quantityname];
                        var quantity = quantityelement.value;
                        if(quantity > 0){
                            validator=true;
                            break;
                        }

                    }                       
                }else{//only one product
                    var quantityname = "quantity" + objfrm.elements['productid[]'].value;
                    var quantityelement = objfrm.elements[quantityname];
                    var quantity = quantityelement.value;
                    if(quantity > 0){
                        validator=false;                            
                    }else{
                        validator=true;
                    }
                }
            }
        }               
        if(!validator){
            alert("Please select a product");
            return;
        }
        objfrm.submit();
    }
    
    function validateProdSelection(){
        var validator=false;
        var systemselector = false;
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmcalc'){
                objfrm = document.forms[i];
            }
        }
        if(objfrm){
            if(objfrm.parentproductid){
                if(objfrm.parentproductid.length){//more than one product
                    var element =  objfrm.parentproductid;   
                    for(var i=0;i<element.length;i++){
                        if(element[i].checked){
                            var subprodctname = "productid" + element[i].value+'[]';
                            var mybtn = objfrm.elements[subprodctname];
                            if(mybtn){
                                if(mybtn.length){//more than one product
                                    for(var j=0;j<mybtn.length;j++){
                                        if(mybtn[j].checked){
                                            validator=true;
                                            break;
                                        }
                                    }                       
                                }else{//only one product
                                    if(mybtn.checked){
                                        validator=true;
                                    }
                                }
                            }
                            //validator=true;
                            break;
                        }
                    }                       
                }else{//only one product
                    if(objfrm.parentproductid.checked){
                        var subprodctname = "productid" + objfrm.parentproductid.value+'[]';
                        var mybtn = objfrm.elements[subprodctname];
                        if(mybtn){
                            if(mybtn.length){//more than one product
                                for(var k=0;k<mybtn.length;k++){
                                    if(mybtn[k].checked){
                                        validator=true;
                                        break;
                                    }
                                }                       
                            }else{//only one product
                                if(mybtn.checked){
                                    validator=true;
                                }
                            }
                        }   
                        validator=true;
                    }
                }    
            }
            
            if(objfrm.system){
                if(objfrm.system.length){//more than one product
                    var element =  objfrm.system;   
                    for(var l=0;l<objfrm.system.length;l++){
                        if(element[l].checked){
                            validator=true;
                            systemselector=true;
                            break;
                        }
                    }                       
                }else{//only one product
                    if(objfrm.system.checked){
                        validator=true;
                        systemselector=true;
                    }
                }    
            }    
            if(!validator){
                alert("Please select a System/Product");
                return;
            }
            if(systemselector){
                showSystemConfirm();    
                //if(msgConfirm("If you would like a standard system click 'Yes'. If you would to select the components click 'No' ")){
                //    objfrm.recommend.value="1";
                //}
            }else{
                objfrm.submit();
            }
            
            //objfrm.submit();
        }                
        
    }
    
    function validateProdSelection1(){
        var validator=false;
        var systemselector = false;
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmcalc'){
                objfrm = document.forms[i];
            }
        }
        if(objfrm){
            var mainprodctname = 'parentproductid' +'[]';
            var mymainproduct = objfrm.elements[mainprodctname];
            if(mymainproduct){
                if(mymainproduct.length){//more than one product
                    var  element =  mymainproduct;
                    for(var i=0;i<element.length;i++){
                        //if(element[i].checked){
                            var subprodctname = "productid" + element[i].value+'[]';
                            var mybtn = objfrm.elements[subprodctname];
                            if(mybtn){
                                if(mybtn.length){//more than one product
                                    for(var j=0;j<mybtn.length;j++){
                                        var quantityname = "quantity" + mybtn[j].value;
                                        var quantityelement = objfrm.elements[quantityname];
                                        var quantity = quantityelement.value;
                                        if(quantity > 0){
                                        //if(mybtn[i].checked){
                                            validator=true;
                                            break;
                                        }
                                    }                       
                                }else{//only one product
                                    var quantityname = "quantity" + mybtn.value;
                                    var quantityelement = objfrm.elements[quantityname];
                                    var quantity = quantityelement.value;
                                    if(quantity > 0){
                                    //if(mybtn.checked){
                                        validator=true;
                                    }
                                }
                            }
                            //validator=true;
                            break;
                        //}
                    }                       
                }else{//only one product
                    //if(objfrm.parentproductid.checked){
                        var subprodctname = "productid" + objfrm.parentproductid.value+'[]';
                        var mybtn = objfrm.elements[subprodctname];
                        if(mybtn){
                            if(mybtn.length){//more than one product
                                for(var k=0;k<mybtn.length;k++){
                                    var quantityname = "quantity" + mybtn[k].value;
                                    var quantityelement = objfrm.elements[quantityname];
                                    var quantity = quantityelement.value;
                                    if(quantity > 0){
                                    //if(mybtn[i].checked){
                                        validator=true;
                                        break;
                                    }
                                }                       
                            }else{//only one product
                                var quantityname = "quantity" + mybtn.value;
                                var quantityelement = objfrm.elements[quantityname];
                                var quantity = quantityelement.value;
                                if(quantity > 0){
                                //if(mybtn.checked){
                                    validator=true;
                                }
                            }
                        }   
                        validator=true;
                    //}
                }    
            }
            
            if(objfrm.system){
                if(objfrm.system.length){//more than one product
                    var element =  objfrm.system;   
                    for(var l=0;l<objfrm.system.length;l++){
                        if(element[l].checked){
                            validator=true;
                            systemselector=true;
                            break;
                        }
                    }                       
                }else{//only one product
                    if(objfrm.system.checked){
                        validator=true;
                        systemselector=true;
                    }
                }    
            }    
            if(!validator){
                alert("Please select a System/Product");
                return;
            }
            if(systemselector){
                showSystemConfirm();    
                //if(msgConfirm("If you would like a standard system click 'Yes'. If you would to select the components click 'No' ")){
                //    objfrm.recommend.value="1";
                //}
            }else{
                objfrm.submit();
            }
            
            //objfrm.submit();
        }                
        
    }
    
    function validateSysSelection(){
        var validator=false;
        var systemselector = false;
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmcalc'){
                objfrm = document.forms[i];
            }
        }
        if(objfrm){
            if(objfrm.recsystem){
                if(objfrm.recsystem.length){//more than one product
                    var element =  objfrm.recsystem;   
                    for(var i=0;i<objfrm.recsystem.length;i++){
                        if(element[i].checked){
                            var subprodctname = "productid" + element[i].value+'[]';
                            var mybtn = objfrm.elements[subprodctname];
                            if(mybtn){
                                if(mybtn.length){//more than one product
                                    for(var j=0;j<mybtn.length;j++){
                                        if(mybtn[j].checked){
                                            validator=true;
                                            break;
                                        }
                                    }                       
                                }else{//only one product
                                    if(mybtn.checked){
                                        validator=true;
                                    }
                                }
                            }
                            //validator=true;
                            systemselector=true;
                            break;
                        }
                    }                       
                }else{//only one product
                    if(objfrm.recsystem.checked){
                        var subprodctname = "productid" + objfrm.recsystem.value+'[]';
                        var mybtn = objfrm.elements[subprodctname];
                        if(mybtn){
                            if(mybtn.length){//more than one product
                                for(var k=0;k<mybtn.length;k++){
                                    if(mybtn[k].checked){
                                        validator=true;
                                        break;
                                    }
                                }                       
                            }else{//only one product
                                if(mybtn.checked){
                                    validator=true;
                                }
                            }
                        }    
                        validator=true;
                        systemselector=true;
                    }
                }    
            }    
            if(!validator){
                alert("Please select a product");
                return;
            }
            /*if(systemselector){
                if(msgConfirm("Do you want to select a list of components or do you want Jiskoot to recommend ?")){
                    objfrm.recommend.value="1";
                }
            }*/
            
            objfrm.submit();
        }                
        
    }
    
    function validateSysSelection1(){
        var validator=false;
        var systemselector = false;
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmcalc'){
                objfrm = document.forms[i];
            }
        }
        if(objfrm){
            var mainprodctname = 'recsystem' +'[]';
            var mymainproduct = objfrm.elements[mainprodctname];
            if(mymainproduct){
                if(mymainproduct.length){//more than onesystem
                    for(var i=0;i<mymainproduct.length;i++){
                            var subprodctname = "productid" + mymainproduct[i].value+'[]';
                            var mybtn = objfrm.elements[subprodctname];
                            if(mybtn){
                                if(mybtn.length){//more than one product
                                    for(var j=0;j<mybtn.length;j++){
                                        var quantityname = "quantity" + mybtn[j].value;
                                        var quantityelement = objfrm.elements[quantityname];
                                        var quantity = quantityelement.value;
                                        if(quantity > 0){
                                            validator=true;
                                            break;
                                        }
                                    }                       
                                }else{//only one product
                                    var quantityname = "quantity" + mybtn.value;
                                    var quantityelement = objfrm.elements[quantityname];
                                    var quantity = quantityelement.value;
                                    if(quantity > 0){
                                        validator=true;
                                    }
                                }
                            }
                            systemselector=true;
                            //break;
                    }                       
                }else{//only one product
                        var subprodctname = "productid" + mymainproduct.value+'[]';
                        var mybtn = objfrm.elements[subprodctname];
                        if(mybtn){
                            if(mybtn.length){//more than one product
                                for(var k=0;k<mybtn.length;k++){
                                    var quantityname = "quantity" + mybtn[k].value;
                                    var quantityelement = objfrm.elements[quantityname];
                                    var quantity = quantityelement.value;
                                    if(quantity > 0){
                                        validator=true;
                                        break;
                                    }
                                }                       
                            }else{//only one product
                                var quantityname = "quantity" + mybtn.value;
                                var quantityelement = objfrm.elements[quantityname];
                                var quantity = quantityelement.value;
                                if(quantity > 0){
                                    validator=true;
                                }
                            }
                        }    
                //        validator=true;
                        systemselector=true;
                }    
            }   
            if(!validator){
                alert("Please select a product");
                return;
            }
            /*if(systemselector){
                if(msgConfirm("Do you want to select a list of components or do you want Jiskoot to recommend ?")){
                    objfrm.recommend.value="1";
                }
            }*/
            
            objfrm.submit();
        }                
        
    }
    
    function showhidediv(divid){
        oDiv = document.getElementById(divid);
        if(oDiv){
            if(oDiv.style.display=='block'){
                oDiv.style.display='none';        
                oImg = document.getElementById("img"+divid);
                if(oImg){
                    oImg.src="images/ftv2pnode.gif";        
                }
            }else{
                oDiv.style.display='block';
                oImg = document.getElementById("img"+divid);
                if(oImg){
                    oImg.src="images/ftv2mnode.gif";        
                }
            }        
        }
        DV=document.body.getElementsByTagName('div');
        if(DV){
            for (i=0;i<DV.length;i++){
                if (DV[i].id!=divid){
                    DV[i].style.display='none';  
                    oImg = document.getElementById("img"+DV[i].id);
                    if(oImg){
                        oImg.src="images/ftv2pnode.gif";        
                    }                          
                }
            }
        }
    }
    
    function onselectcp(){
        var myform;
        var selectviscosity="";
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='frmquestionnaire'){
                myform = document.forms[i];
            }
        }
        if(!myform) {
            return;
        }
        if(myform.viscosityunits){
            selectviscosity=myform.viscosityunits.options[myform.viscosityunits.selectedIndex].value;
        }
        if(selectviscosity=="cP"){
            var dayelement = myform.specificgravityunits;
            if(dayelement){
                var dayoptions = dayelement.options;
                for(var i=0;i<=dayoptions.length;i++){
                    if(dayoptions[i].value=="SG"){
                        dayoptions[i].selected=true;
                        break;
                    }
                }
            } 
            
        }
    }
    function ValidateRegister(){
	     var bRetVal=false;
        var objfrm;
        for(var i=0;i<document.forms.length;i++){
            if(document.forms[i].id=='form1'){
                objfrm = document.forms[i];
            }
        }
        if(objfrm){
	        if(objfrm.LastName.value.length==0){
		        alert("Please enter your last name");
		        objfrm.LastName.focus();
			    return false;
	        }
	        if(objfrm.Email.value.length==0){
		        alert("Please enter your email address");
		        objfrm.Email.focus();
			    return false;
	        }
	    return true;    
        }
        
    }