﻿// JScript File

function fnCategoryChange()
{
    
     if(document.getElementById("ctrlDynamicContent_drpdwnlstCategory").value!="0")
		 window.location.href= document.getElementById("ctrlDynamicContent_drpdwnlstCategory").value;
    else
        return false;
}
function fnVariableAssignForEmail(hdnClientSk,hdnCategorySk)
{

     document.getElementById('ctrlProfileCaptcha_hdnProfileClientSk').value=hdnClientSk;//document.getElementById('hdnClientSk').value;
    document.getElementById('ctrlProfileCaptcha_hdnProfileCatergorySk').value=hdnCategorySk;//;document.getElementById('hdnCategorySk').value;

}
function fnValidateProfileEmail()
{
document.getElementById("ctrlProfileCaptcha_PageURL").value =location.href; 
document.getElementById('ctrlProfileCaptcha_hdnProfileClientSk').value = document.getElementById('hdnProfileClientSk').value;
document.getElementById('ctrlProfileCaptcha_hdnISOutBoundTrackingscript').value = document.getElementById('hdnISOutBoundTrackingscript').value;
document.forms[0].action =location.href;
  if(navigator.appName == 'Microsoft Internet Explorer')
      document.getElementById('ctrlProfileCaptcha_ctrlErrorMessage_divErrorMsg').innerHTML='';
  else
      document.getElementById('ctrlProfileCaptcha_ctrlErrorMessage_divErrorMsg').textContent='';
   if(lTrim(document.getElementById("ctrlProfileCaptcha_txtFirstName").value).length==0)
   {

        error(105,'','');
        document.getElementById("ctrlProfileCaptcha_txtFirstName").value="";
        document.getElementById("ctrlProfileCaptcha_txtFirstName").focus();
        return false
   }
   else if(lTrim(document.getElementById("ctrlProfileCaptcha_txtLastName").value).length==0)
   {
        error(104,'','');
        document.getElementById("ctrlProfileCaptcha_txtLastName").value="";
        document.getElementById("ctrlProfileCaptcha_txtLastName").focus();
        return false
   }
   else if(lTrim(document.getElementById("ctrlProfileCaptcha_txtEmailAddress").value).length==0)
   {
        error(103,'','');
        document.getElementById("ctrlProfileCaptcha_txtEmailAddress").value="";
        document.getElementById("ctrlProfileCaptcha_txtEmailAddress").focus();
        return false
   }
   else if(lTrim(document.getElementById("ctrlProfileCaptcha_txtEmailAddress").value).length>0 && ValidateEmail(document.getElementById("ctrlProfileCaptcha_txtEmailAddress").value)==false)
   {
        error(102,'','');
        document.getElementById("ctrlProfileCaptcha_txtEmailAddress").focus();
        return false
   }
   else if(lTrim(document.getElementById("ctrlProfileCaptcha_txtCompanyName").value).length==0)
   {
        error(101,'','');
        document.getElementById("ctrlProfileCaptcha_txtCompanyName").value="";
        document.getElementById("ctrlProfileCaptcha_txtCompanyName").focus();
        return false
   }
   else if(lTrim(document.getElementById("ctrlProfileCaptcha_txtZip").value).length==0)
   {
        error(100,'','');
        document.getElementById("ctrlProfileCaptcha_txtZip").value="";
        document.getElementById("ctrlProfileCaptcha_txtZip").focus();
        return false
   }
   else if(lTrim(document.getElementById("ctrlProfileCaptcha_Captcha1_txtCaptcha").value).length==0)
   {
        error(106,'','');
        document.getElementById("ctrlProfileCaptcha_Captcha1_txtCaptcha").value="";
        document.getElementById("ctrlProfileCaptcha_Captcha1_txtCaptcha").focus();
        return false
   }
   else
   {
        return true;
   }
   
}
function btnG_onclick()
{
//alert('gfhjf');
 //document.location.href ="www.google.com";
 //window.open("http://gmini.iqsdirectory.com/search?q="+ document.getElementById("txtSearch").value + "&btnG=&site=IQSdirectory&client=IQS&proxystylesheet=IQS&output=xml_no_dtd");
 document.location.href ="http://gmini.iqsdirectory.com/search?q="+ document.getElementById("txtSearch").value + "&btnG=&site="+ document.getElementById("hdnSite").value + "&client="+ document.getElementById("hdnClient").value + "&proxystylesheet="+ document.getElementById("hdnProxy").value + "&output="+ document.getElementById("hdnOutput").value;
 return false;
}
function CheckKeyDown(e)

{
    var exp;
    if(navigator.appName=="Microsoft Internet Explorer") 
    {
                exp= window.event.keyCode;
    } 
    else
    {
                exp=e.which;
    } 

    if (exp==13)
            {
                document.getElementById('btnSubmit').click();
		return false;
            }

}



/********** To check the max length for  Description**********/
function fnMaxLength(val,Id,count)
{
   
        var _varId = Id.id;
        var exp=val.which;
        
        if(navigator.appName == 'Microsoft Internet Explorer')
            document.getElementById('ctrlProfileCaptcha_ctrlErrorMessage_divErrorMsg').innerHTML='';
        else
            document.getElementById('ctrlProfileCaptcha_ctrlErrorMessage_divErrorMsg').textContent='';
       
        if(lTrim(document.getElementById(_varId).value).length > count)
        {
            if(navigator.appName=="Microsoft Internet Explorer")
            {
                event.keyCode = 0;
            }
            else
            {
                if(exp == 8 || exp == 0)
                {
                    return true;
                }
                else
                {
                    val.preventDefault();
                    return;
                }
            }
        }
    
}
//When enter Key Press on TextBox
function fnEnterKeyCommon(e)
{    
   
    var exp;
    if(navigator.appName == 'Microsoft Internet Explorer')
    {	
        exp=e.keyCode;
    }
    else
    {
        exp=e.which;	
    }  
    
    if(exp==13)
    {
        return false;
        
    }
    else
    {
        return true;
    }
}


