
   function clearTextEmail()
   {

        document.getElementById("ctl00_textfield").value = "";
   }

 function Details(elementId)
   { 
   
           var element = document.getElementById(elementId);
	        if(element.style.display != "block")
	        {	            
		        element.style.display = "block";
		        WebForm_AutoFocus('ctl00_btnSubmit');
		        //Sys.Application.initialize();
	        }
	        else
	        {
		        element.style.display = "none";
	        }  
   }   
   
    function ChangeFocus()
   { 
        var element = document.getElementById('ctl00_loginDetails');
        element.onfocus();
   }
   //WOOD BASED PANELS SCRIPT STARTS HERE//
  var persistmenu="yes" //"yes" or "no". Each SPAN contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ 
document.write('<style type="text/css">\n')
document.write('.subMenuItem{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var img = document.getElementById('img'+obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="subMenuItem") 
				ar[i].style.display = "none";
			}
			el.style.display = "block";
			img.src = '/Images/wbp-up.gif';
		}else{
			el.style.display = "none";
			img.src = '/Images/wbp-down.gif';
		}
	}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
  function WbpSearchRedirect()
  {

   var txtwbpSearch = document.getElementById('txtwbpSearch').value;
       if(txtwbpSearch == '')
       {
            window.open('http://www.wbpionline.com/news/search.php?_FB%5Bq%5D=&SUBMIT%5Bsubmit2%5D=Search','_self');
       }
       else
       {
            window.open('http://www.wbpionline.com/news/search.php?_FB%5Bq%5D='+ txtwbpSearch +'&SUBMIT%5Bsubmit2%5D=Search','_self');       
       }
  }
   //WOOD BASED PANELS SCRIPT ENDS HERE//
  
  
  function showadvSearchPanel()
    {   

     document.getElementById("ctl00_ContentPlaceHolder1_search_op").style.display="block";
    }
    
    function HideadvSearchPanel()
    
    { 
      document.getElementById("ctl00_ContentPlaceHolder1_search_op").style.display = "none";
         
    }
  
   function showAllNewsAndProjects()
    {
    //satya changed for news and projects
            var divNewsAndprojects = document.getElementById("ctl00_ContentPlaceHolder1_divNewsAndprojects");
            divNewsAndprojects.style.display="none"; 
            var divallNewsAndprojects = document.getElementById("ctl00_ContentPlaceHolder1_divallNewsAndprojects");
            divallNewsAndprojects.style.display="block"; 
            var lnkViewMore = document.getElementById("ctl00_ContentPlaceHolder1_lnkViewMore");
            lnkViewMore.style.display="none";               
            var lnkviewback = document.getElementById("ctl00_ContentPlaceHolder1_lnkviewback");
            lnkviewback.style.display="block";
            //
    }
    function showTopNewsAndProjects()
    {
            var divNewsAndprojects = document.getElementById("ctl00_ContentPlaceHolder1_divNewsAndprojects");
            divNewsAndprojects.style.display="block";
            var divallNewsAndprojects = document.getElementById("ctl00_ContentPlaceHolder1_divallNewsAndprojects");
            divallNewsAndprojects.style.display="none"; 
            var lnkViewMore = document.getElementById("ctl00_ContentPlaceHolder1_lnkViewMore");
            lnkViewMore.style.display="block";               
            var lnkviewback = document.getElementById("ctl00_ContentPlaceHolder1_lnkviewback");
            lnkviewback.style.display="none";
    
    }
    
    function showAllDownloads()
    {     
    
            var divTopDownLoads = document.getElementById("ctl00_ContentPlaceHolder1_divTopDownLoads");
            divTopDownLoads.style.display="none";
            var divAllCompanyDownloads = document.getElementById("ctl00_ContentPlaceHolder1_divAllProductDownloads");
            divAllCompanyDownloads.style.display="block"; 
            var lnkDownloads = document.getElementById("ctl00_ContentPlaceHolder1_lnkMoreDownloads");
            lnkDownloads.style.display="none";
             var lnkBack = document.getElementById("ctl00_ContentPlaceHolder1_lnkBack");
            lnkBack.style.display="block";
            
        } 
        function showTopDownloads()
        {
               var divTopDownLoads = document.getElementById("ctl00_ContentPlaceHolder1_divTopDownLoads");
                divTopDownLoads.style.display="block";
                var divAllCompanyDownloads = document.getElementById("ctl00_ContentPlaceHolder1_divAllProductDownloads");
                divAllCompanyDownloads.style.display="none";    
                 var lnkDownloads = document.getElementById("ctl00_ContentPlaceHolder1_lnkMoreDownloads");
            lnkDownloads.style.display="block";
             var lnkBack = document.getElementById("ctl00_ContentPlaceHolder1_lnkBack");
            lnkBack.style.display="none"; 
                      
                  
         }
         function ShowOperatioanlArea()
         {
            var divOperationalArea = document.getElementById("divOperationalArea");
            divOperationalArea.style.display="block";
            var divlnkOperationalArea = document.getElementById("divlnkOperationalArea");
            divlnkOperationalArea.style.display="none";
            var divBack = document.getElementById("divBack");
            divBack.style.display="block";            
         }
         function HideOperatioanlArea()
         {
            var divOperationalArea = document.getElementById("divOperationalArea");
            divOperationalArea.style.display="none";
            var divlnkOperationalArea = document.getElementById("divlnkOperationalArea");
            divlnkOperationalArea.style.display="block";
            var divBack = document.getElementById("divBack");
            divBack.style.display="none";            
         }
  
   function IsNumeric(txt)
        {
           var ValidChars = "0123456789.";
           var IsNumber=true;
           var Char;   
            var sText1 = txt.value;
           for (i = 0; i < sText1.length && IsNumber == true; i++) 
              { 
              Char = sText1.charAt(i); 
              if (ValidChars.indexOf(Char) == -1) 
                 {        
                 IsNumber = false;
        	      alert("Enter Numbers Only");
                 }
                 else
                 {
                 }
              }
           return IsNumber;   
       }
       
       
          function AvoidSpace(evt,txtname)
        {
          var charCode = (evt.which) ? evt.which : event.keyCode

            if (charCode == 32)
            {           
               return false;
               
               }
               else
               {
           
             return true;
                }
        }
  
     
         function ValidateForm()
        {  
        debugger;      
            var theForm = document.forms['aspnetForm'];
            if (!theForm)
            {
                theForm = document.aspnetForm;
            }
            if(validateCompleteForm(theForm,'error') == true)
            {
                var hdnCompIds = document.getElementById("ctl00_ContentPlaceHolder1_hdnCompIds");
                if(hdnCompIds != null)
                {
                      var c_value = "";
                      var S_value="";
                        if(theForm.music != null)
                         {
                            for (var i=0; i < theForm.music.length; i++)
                            {            
                                if (theForm.music[i].checked)
                                {  
                                   var selectedIds=   theForm.music[i].id.substring(3,theForm.music[i].id.length);
                                    c_value = c_value + selectedIds+",";              
                                }
                            }
                        }
                        if((theForm.music != null)&&(c_value ==""))
                        {
                            if (theForm.music.checked)
                            {  
                               var selectedIds=   theForm.music.id.substring(3,theForm.music.id.length);
                                c_value = c_value + selectedIds+",";              
                            }
                        } 
                         if(theForm.standard != null)
                         {
                            for (var i=0; i < theForm.standard.length; i++)
                            {            
                                if (theForm.standard[i].checked)
                                {  
                                   var selectedIds=   theForm.standard[i].id.substring(3,theForm.standard[i].id.length);
                                    S_value = S_value + selectedIds+",";              
                                }
                            }
                        }
                        if((theForm.standard != null)&&(c_value ==""))
                        {
                            if (theForm.standard.checked)
                            {  
                               var selectedIds=   theForm.standard.id.substring(3,theForm.standard.id.length);
                                S_value = S_value + selectedIds+",";              
                            }
                        }          
                    
                        if(c_value=="" && S_value=="")
                        {
                          alert("Please select atleast one item");
                          return false;
                        }
                        else
                        {
                            hdnCompIds.value= c_value+S_value;   
                             
                        } 
                  }     
                  return true;    
            }
            else
            {
                return false;
            }
          
        }
  
  
   function DisplayNewImageInWidnow(imgProductLogo) 
    {     
       var img = document.getElementById(imgProductLogo).src;   
        var width=(document.getElementById(imgProductLogo).width*2);
        var height=(document.getElementById(imgProductLogo).height*2);
        html = "<HTML><HEAD><TITLE>Photo</TITLE>" 
        +  "</HEAD><BODY LEFTMARGIN=0 "   
        + "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>"   
        + "<IMG src='" 
        + img 
        + "' BORDER=0 width='"+width+"'height='"+height+ "' NAME=image "   
        + "onload='window.resizeTo(500,540)'>"  
        + "</CENTER>"   
        + "</BODY></HTML>"; 
          var winl = (screen.width - width) / 2;
     var wint = (screen.height - height) / 2;
        popup= window.open  ('','image','toolbar=0,location=0,top='+winl+',left='+wint+',directories=0,menuBar=0,scrollbars=0,resizable=1'); 
        popup.document.open(); 
        popup.document.write(html); 
        popup.document.focus(); 
        popup.document.close();
        return false;
   }
   function DisplayNewImageInModelWidnow(imgProductLogo) 
    {   

       var img = document.getElementById(imgProductLogo).src; 
       var divEnlargeProd = document.getElementById('divEnlargeProd'); 
        divEnlargeProd.style.background = "url('"+ img +"') no-repeat center"; 
        divEnlargeProd.style.top = "10%";
       /*var imgEnlargeProd = document.getElementById('imgEnlargeProd');  
       imgEnlargeProd.src = img;*/
           
        return false;
   }
   function showAsMainImage(ProductId)
    {  
        var s = document.getElementById(ProductId).src.toString();
        document.getElementById(ProductId).src=document.getElementById('ctl00_ContentPlaceHolder1_imgProductLogo').src.toString();
        document.getElementById('ctl00_ContentPlaceHolder1_imgProductLogo').src=s; 
        return false;
    }
    
  function SelectCountries(key)
{
    var lstcountryList= document.getElementById("ctl00_ContentPlaceHolder1_lstCountry");
    var geographyIds="";  
    
    for(var i=0;i<lstcountryList.options.length;i++)
    {
        if(lstcountryList.options[i].value != "Select region for countries")
        { 
            if(lstcountryList.options[i].selected)
            {
               geographyIds+=lstcountryList.options[i].value;
               geographyIds+=",";
            }
        }
    }
    geographyIds=geographyIds.substring(0,geographyIds.lastIndexOf(","));
    document.getElementById("ctl00_ContentPlaceHolder1_hdnSltCounties").value=geographyIds;
 }
 function CheckRegionCountries(key)
{
var lstcountryList= document.getElementById("ctl00_ContentPlaceHolder1_lstGeography");
    var geographyIds="";   
    for(var i=0;i<lstcountryList.options.length;i++)
    {
        if(lstcountryList.options[i].value != "Select")
        {
            if(lstcountryList.options[i].selected)
            {
               geographyIds+=lstcountryList.options[i].value;
               geographyIds+=",";
            }
        }
    }
    geographyIds=geographyIds.substring(0,geographyIds.lastIndexOf(","));


    var lstcountryLists= document.getElementById("ctl00_ContentPlaceHolder1_lstCountry");
    var geography="";   
    for(var i=0;i<lstcountryLists.options.length;i++)
    {
        if(lstcountryLists.options[i].value != "Select region for countries")
        {
            if(lstcountryLists.options[i].selected)
            {
               geography+=lstcountryLists.options[i].value;
               geography+=",";
            }
        }
    }    
    geography=geography.substring(0,geography.lastIndexOf(","));
    if (geographyIds=="")
    { 
         alert("Select Atleast One Region");
         return false;         
    }
    else
    {
        return true;     
    }
 }  
 
 
 
 
 function ClearRegionCountries(key)
{
var lstcountryList= document.getElementById("ctl00_ContentPlaceHolder1_lstGeography");
     
    for(var i=0;i<lstcountryList.options.length;i++)
    {
        if(lstcountryList.options[i].value != "Select")
        {
            if(lstcountryList.options[i].selected)
            {
               lstcountryList.options[i].selected=false;
            }
        }
    }   


    var lstcountryLists= document.getElementById("ctl00_ContentPlaceHolder1_lstCountry");    
    for(var i=0;i<lstcountryLists.options.length;i++)
    {
        if(lstcountryLists.options[i].value != "Select region for countries")
        {
            if(lstcountryLists.options[i].selected)
            {
              lstcountryLists.options[i].selected=false;               
            }
        }
    }    
    return false;     
    
 }      
    function SelectCraneCountries(key)
{

    var lstcountryList= document.getElementById("ctl00_ContentPlaceHolder1_lstCountry");
    var geographyIds="";  
    
    for(var i=0;i<lstcountryList.options.length;i++)
    {
        if(lstcountryList.options[i].value != "Select region for countries")
        { 
            if(lstcountryList.options[i].selected)
            {
               geographyIds+=lstcountryList.options[i].value;
               geographyIds+=",";
            }
        }
    }
    geographyIds=geographyIds.substring(0,geographyIds.lastIndexOf(","));
    document.getElementById("ctl00_ContentPlaceHolder1_hdnSltCounties").value=geographyIds;
 }
  function RedirectToExternalSite(urlpath,openStatus)
    {   
     
        
        var url = urlpath.replace(/ctl00_/g,""); 
        if(openStatus == false)
        {
            var sFeatures="scrollbars=yes,resizable=yes,location=yes,status=yes,width=1010,height=630,toolbar=yes,menubar=yes";
            var newwindow= window.open (url,"mywindow",sFeatures);
            if (window.focus)
             {
             newwindow.focus()
             } 
             return true;
        }
        else
        {
            window.location.href = url;
        }
    }
  
   function SearchGoUrl()
    {    

        var Value = document.getElementById('ctl00_textfield').value;         
        var url = arguments[0] + Value; 
        url = url.replace(/ctl00_/g,""); 
        if(arguments[1] == false)
        {
        var sFeatures="scrollbars=yes,resizable=yes,location=yes,status=yes,width=1010,height=630,toolbar=yes,menubar=yes";
        var newwindow= window.open (url,"mywindow",sFeatures);
        if (window.focus)
         {
         newwindow.focus()
         } 
         return true;
        }
        else
        {
            window.location.href = url;
        }
    }
    
function ChangeSelectedindex(selectedtext)
{
  if(selectedtext=="Companies")
  {
     var UrlPrefix = location.href;
     var UrlDetails = new Array();
     UrlDetails=UrlPrefix.split("/");              
     UrlPrefix = UrlDetails[0] + "/" + UrlDetails[1] + "/" + UrlDetails[2] + "/";  
     AddhrefForAtoZ(UrlPrefix,"Companies");   
    
  }
  else 
  {
     var UrlPrefix = location.href;
     var UrlDetails = new Array();
     UrlDetails=UrlPrefix.split("/");              
     UrlPrefix = UrlDetails[0] + "/" + UrlDetails[1] + "/" + UrlDetails[2] + "/";  
     AddhrefForAtoZ(UrlPrefix,"Products");   
 
  }

}

function AddhrefForAtoZ(url,pagename)
{
        document.getElementById("ctl00_ContentPlaceHolder1_href0to9").href = url + pagename + "/0-9";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefA").href = url + pagename + "/A";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefB").href = url + pagename + "/B";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefc").href = url + pagename + "/C";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefd").href = url + pagename + "/D";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefe").href = url + pagename + "/E";
        document.getElementById("ctl00_ContentPlaceHolder1_hreff").href = url + pagename + "/F";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefg").href = url + pagename + "/G";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefh").href = url + pagename+ "/H";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefi").href = url + pagename + "/I";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefj").href = url + pagename + "/J";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefk").href = url + pagename + "/K";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefl").href = url + pagename + "/L";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefm").href = url + pagename+ "/M";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefn").href = url + pagename + "/N";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefo").href = url + pagename + "/O";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefp").href = url + pagename + "/P";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefq").href = url + pagename + "/Q";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefr").href = url + pagename + "/R";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefs").href = url + pagename + "/S";
        document.getElementById("ctl00_ContentPlaceHolder1_hreft").href = url + pagename + "/T";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefu").href = url + pagename + "/U";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefv").href = url + pagename + "/V";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefw").href = url + pagename + "/W";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefx").href = url + pagename + "/X";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefy").href = url + pagename + "/Y";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefz").href = url + pagename + "/Z";
        document.getElementById("ctl00_ContentPlaceHolder1_hrefViewAll").href = url + pagename;
}
  
  
function validationforCranessite(key)
{

var lstDealerlocation= document.getElementById("ctl00_ContentPlaceHolder1_ddlDealerlocation");
    var DealerIds="";   
    for(var i=0;i<lstDealerlocation.options.length;i++)
    {
        if(lstDealerlocation.options[i].value != "--Select--")
        {
            if(lstDealerlocation.options[i].selected)
            {
               DealerIds+=lstDealerlocation.options[i].value;
               DealerIds+=",";
            }
        }
    }
    DealerIds=DealerIds.substring(0,DealerIds.lastIndexOf(","));


    var DealerNameSearch= document.getElementById("ctl00_ContentPlaceHolder1_txtDealerNameSearch").value;
   
    if (DealerIds=="" && DealerNameSearch=="")
    { 
         alert("Enter dealer name or select location");
         return false;         
    }
    else
    {
        return true;     
    }
 } 
 function chkAuthorization(id,name,value)
{ 
    if(document.getElementById("ctl00_ContentPlaceHolder1_txtCodeCompare").value.toLowerCase()==document.getElementById("ctl00_ContentPlaceHolder1_hideCodeCompare").value.toLowerCase())
    {
        return true;
    }
    return false;
} 
function PageBack()
{  
    history.go(-1);    
  
}


function craneSpecification()
{

  var txtKeyWord = document.getElementById("ctl00_ContentPlaceHolder1_txtKeyWord");
  var txtModel = document.getElementById("ctl00_ContentPlaceHolder1_txtModel");
  var txtMaxPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtMaxPrice");
  var ddlAge = document.getElementById("ctl00_ContentPlaceHolder1_ddlAge").selectedIndex;
  var ddlCondition = document.getElementById("ctl00_ContentPlaceHolder1_ddlCondition").selectedIndex;
  var txtCapacityStart = document.getElementById("ctl00_ContentPlaceHolder1_txtCapacityStart");
  var txtCapacityEnd = document.getElementById("ctl00_ContentPlaceHolder1_txtCapacityEnd");
  var ddlCraneCountry = document.getElementById("ctl00_ContentPlaceHolder1_ddlCraneCountry").selectedIndex;
  var ddlCraneCity = document.getElementById("ctl00_ContentPlaceHolder1_ddlCraneCity").selectedIndex;
  
  if((txtKeyWord.value == '') && (txtModel.value == '') && (txtMaxPrice.value == '') && (txtCapacityStart.value == '') && (txtCapacityEnd.value == '') && (ddlAge == 0) && (ddlCondition == 0) && (ddlCraneCountry == 0) && (ddlCraneCity == 0))
  {
    alert("Enter values for refine results by crane specification");
    return false;
  }
  else
  {
    return true;
  }
  
}  

function WebForm_FireDefaultButton(event, target) {
    if (event.keyCode == 13) {
        var defaultButton;
        if (__nonMSDOMBrowser) {
            defaultButton = document.getElementById(target);
        }
        else {
            defaultButton = document.all[target];
        }
        if (defaultButton && typeof(defaultButton.click) != "undefined") {
            defaultButton.click();
            event.cancelBubble = true;
            if (event.stopPropagation) event.stopPropagation();
            return false;
        }
    }
    return true;
}

$(document).ready(function() {

        $('#ctl00_ContentPlaceHolder1_EmailFriend').click(function() { 
                 $('#TiteRequired').hide(1000);
                 $('#NameReqired').hide(1000);
                 $('#EmailErrordevEmail').hide(1000);
                 $('#CountryRequired').hide(1000);
                 $('#CityRequired').hide(1000);
                 $('#RequestEnquiry').hide(1000);
                 
                var re = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
                
                 if (($('#ctl00_ContentPlaceHolder1_ddlExpTitle').val() == "--Select--")) {
                        $('#TiteRequired').show(1000);
                        return false;
                }
                else
                {
                $('#TiteRequired').hide(1000);
                }

                if (($('#ctl00_ContentPlaceHolder1_SenderName').val() == '')) {
                    $('#NameReqired').show(1000);            
                    return false;
                }
                else
                {
                 $('#NameReqired').hide(1000);
                }
                
                if (($('#ctl00_ContentPlaceHolder1_SenderMailId').val().search(re) == -1)) {
                        $('#EmailErrordevEmail').show(1000);
                        return false;
                }
                else
                {
                    $('#EmailErrordevEmail').hide(1000);
                }
                
                
                if (($('#ctl00_ContentPlaceHolder1_ddlCountryReq').val() == "--Select--")) {
                        $('#CountryRequired').show(1000);
                        return false;
                }
                else
                {
                    $('#CountryRequired').hide(1000);
                }
                
                if (($('#ctl00_ContentPlaceHolder1_txtCityReq').val() == '')) {
                        $('#CityRequired').show(1000);
                        return false;
                }
                else
                {
                $('#CityRequired').hide(1000);
                }
                
                if (($('#ctl00_ContentPlaceHolder1_txtMailBody').val() == '')) {
                        $('#RequestEnquiry').show(1000);
                        return false;
                }
                else
                {
                    $('#RequestEnquiry').hide(1000);
                }
               
                __doPostBack('EmailFriendClick');
                 return false;          
             });
       });

    // For Multiple RFI in Directories //
    
function MultipleSelectForRFI(type)
{
    var count =0;
    var allcount=0;
   var divSelectedResults = document.getElementById("divSelectedResults");
   divSelectedResults.className ="selectedListBasket tm";
    var selectedCompaniesInnerHTML = new String();
    var theForm = document.forms['aspnetForm'];
    if (!theForm)
    {
    theForm = document.aspnetForm;
    }
    divSelectedResults.innerHTML=""; 
    if(type=="C")
    {   
    selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<div class=\"clear\"></div><div class=\"result_header\"><h3>Selected Companies</h3><hr/></div><div class=\"clear\"></div><div class=\"selectedItemList\"><ul>");
    }
    else if(type=="P" || type=="CF")
    {
    selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<div class=\"clear\"></div><div class=\"result_header\"><h3>Selected Products</h3><hr/></div><div class=\"clear\"></div><div class=\"selectedItemList\"><ul>");
    }
    else
    {
    selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<div class=\"clear\"></div><div class=\"result_header\"><h3>Selected News</h3><hr/></div><div class=\"clear\"></div><div class=\"selectedItemList\"><ul>");
    }
    
    var DeleteImage = "/Images/deletedSelectedItem.gif";
     var URL = window.location.href;
    if(URL.indexOf("fx.interior-design-buyers-guide.com") !=-1)
    {
       DeleteImage = "/Images/deletedSelectedItem_fx.gif";
    }
    else if(URL.indexOf("wbpi.wood-based-panels-buyers-guide.com") !=-1)
    {
        DeleteImage = "/Images/deletedSelectedItem_wbpi.gif";
    }   
    else if(URL.indexOf("www.cranesmarketplace.com") !=-1)
    {
        DeleteImage = "/Images/deletedSelectedItem_cranes.gif";
    }
    
    for (var i=0; i < theForm.music.length; i++)
    {     
        allcount=allcount+1;       
        if (theForm.music[i].checked)
        { 
         var selectedIds=   theForm.music[i].id.substring(3,theForm.music[i].id.length);
           var CompanyName = document.getElementById("chk"+selectedIds).value;
           if(type=="P")
           {
           selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<li class=\"largeContent\"><img src=\""+DeleteImage+"\" alt=\"\" onclick=\"javascript:UnselectSelectedCompany('"+theForm.music[i].id+"','"+type+"');\" class=\"hand\" />"+ CompanyName +"</li>");              
           }
           else if(type=="N")
           {
           selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<li><img src=\""+DeleteImage+"\" alt=\"\" onclick=\"javascript:UnselectSelectedCompany('"+theForm.music[i].id+"','"+type+"');\" class=\"hand\" />"+theForm.music[i].value+"</li>");              
           }
           else
           {
           selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<li><img src=\""+DeleteImage+"\" alt=\"\" onclick=\"javascript:UnselectSelectedCompany('"+theForm.music[i].id+"','"+type+"');\" class=\"hand\" />"+CompanyName+"</li>");              
           }
           count = count+1;
        }
    }
    if(count != allcount)
    {
     document.getElementById("chkprecompany").checked=false;
     if(document.getElementById("chkbottomselectall") != null)
     {
     document.getElementById("chkbottomselectall").checked=false;
     }
    }
    else
    {
    document.getElementById("chkprecompany").checked=true;
    if(document.getElementById("chkbottomselectall") != null)
     {
     document.getElementById("chkbottomselectall").checked=true;
     }
    }  
    if((theForm.music != null)&&(count ==0))
    {
        if (theForm.music.checked)
        { 
         var selectedIds=   theForm.music.id.substring(3,theForm.music.id.length);
           var CompanyName = document.getElementById("chk"+selectedIds).value;          
           
           if(type=="P")
           {
           selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<li class=\"largeContent\"><img src=\""+DeleteImage+"\" alt=\"\" onclick=\"javascript:UnselectSelectedCompany('"+theForm.music.id+"','"+type+"');\" class=\"hand\" />"+ CompanyName +"</li>");              
           }
           else if(type=="N")
           {
           selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<li><img src=\""+DeleteImage+"\" alt=\"\" onclick=\"javascript:UnselectSelectedCompany('"+theForm.music.id+"','"+type+"');\" class=\"hand\" />"+theForm.music.value+"</li>");              
           }
           else
           {
           selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("<li><img src=\""+DeleteImage+"\" alt=\"\" onclick=\"javascript:UnselectSelectedCompany('"+theForm.music.id+"','"+type+"');\" class=\"hand\" />"+CompanyName+"</li>");              
           }
           count = count+1;
           document.getElementById("chkprecompany").checked=true;
            if(document.getElementById("chkbottomselectall") != null)
            {
             document.getElementById("chkbottomselectall").checked=true;
             }
        }
        else
        {
            document.getElementById("chkprecompany").checked=false;
            if(document.getElementById("chkbottomselectall") != null)
            {
             document.getElementById("chkbottomselectall").checked=false;
             }
        }
       
    }
    selectedCompaniesInnerHTML = selectedCompaniesInnerHTML.concat("</ul><div class=\"clear\"></div></div>");
    divSelectedResults.innerHTML = selectedCompaniesInnerHTML;
    if(count ==0)
    {
        divSelectedResults.className ="none";
         document.getElementById("chkprecompany").checked=false;
         if(document.getElementById("chkbottomselectall") != null)
            {
             document.getElementById("chkbottomselectall").checked=false;
             }
    }
}
 


function selectAllForEnquery(type)
{
debugger;
        var all_value=""; 
        var count =0;      
        for (var i=0; i < theForm.allselect.length; i++)
        { 
            if (theForm.allselect.checked)
            { 
                all_value=all_value+1;
            }
        }
        
        if((theForm.allselect != null)&&(all_value ==""))
        {
            if (theForm.allselect.checked)
            {  
                for (var i=0; i < theForm.music.length; i++)
                {            
                   theForm.music[i].checked=true;
                   count = count+1;
                }  
                 if((theForm.music != null)&&(count ==0))
                 {
                    theForm.music.checked = true;
                 }          
            }
            else
            {
                for (var i=0; i < theForm.music.length; i++)
                {            
                   theForm.music[i].checked=false;
                    count = count+1;
                } 
                if((theForm.music != null)&&(count ==0))
                 {
                    theForm.music.checked = false;
                 }
            }
        } 
        MultipleSelectForRFI(type);
}

function BottomselectAllForEnquery(type)
{
        var Bottom_value="";     
         var count =0;        
        for (var i=0; i < theForm.bottomall.length; i++)
        { 
            if (theForm.bottomall.checked)
            { 
                Bottom_value=Bottom_value+1;
            }
        }
        
        if((theForm.bottomall != null)&&(Bottom_value ==""))
        {
            if (theForm.bottomall.checked)
            {  
                for (var i=0; i < theForm.music.length; i++)
                {            
                   theForm.music[i].checked=true;
                   count = count+1;
                }   
                if((theForm.music != null)&&(count ==0))
                 {
                    theForm.music.checked = true;
                 }          
            }
            else
            {
                for (var i=0; i < theForm.music.length; i++)
                {            
                   theForm.music[i].checked=false;
                   count = count+1;
                } 
                if((theForm.music != null)&&(count ==0))
                 {
                    theForm.music.checked = false;
                 }
            }
        }     
        MultipleSelectForRFI(type);
}

function UnselectSelectedCompany(CompanyID,type)
{
    var chkUncheck = document.getElementById(CompanyID);
    chkUncheck.checked = false;
    document.getElementById("chkprecompany").checked=false;
     if(document.getElementById("chkbottomselectall") != null)
            {
             document.getElementById("chkbottomselectall").checked=false;
             }
    MultipleSelectForRFI(type);
}

function OnCompanySubmit(CompanyIDs,type)
{
     var CompanyID = CompanyIDs.split(",");
    for (var i=0; i < CompanyID.length-1; i++)
    {            
       var chk = document.getElementById("chk"+CompanyID[i]);
       chk.checked = true;
    } 
    var  count=0; 
    if(theForm.music!=null)
   {  
       for (var i=0; i < theForm.music.length; i++)
        {            
         count=count+1;
        }
    }
    if((theForm.music != null)&&(count ==0))
    {
        if (theForm.music.checked)
        { 
         count=count+1;
        }
     }
     if(count !=0)  
    {
        MultipleSelectForRFI(type);
    }
}

function allResultValidations()
    { 
    debugger;
     var falsCount=0;    
    var isValidated = true;    
    if(validate_requiredTitle()!= true )
    {
     falsCount=falsCount+1;
    }
   
    if(validate_requiredtxtFullName()!= true)
    {
         falsCount=falsCount+1;
    }
    if( validate_requiredtxtEmail()!= true)
    {
        falsCount=falsCount+1;
    }
    
    if(validate_requiredCountry()!= true)
    {
        falsCount=falsCount+1;
    }
     if(validate_requiredtxtCity()!= true)
    {
         falsCount=falsCount+1;
    }
     if(validate_requiredtxtEnquiry()!= true)
    {
         falsCount=falsCount+1;
    }
    if(validate_requiredtxtVerify()!= true)
    {
         falsCount=falsCount+1;
    }  
    if(falsCount>0)
    {
        isValidated = false;
    }
    if(isValidated == true)
    {
        var c_value = "";
        var S_value="";
        var theForm = document.forms['aspnetForm'];
            if (!theForm)
            {
                theForm = document.aspnetForm;
            }
         if(theForm.music != null)
         {
            for (var i=0; i < theForm.music.length; i++)
            {            
                if (theForm.music[i].checked)
                {  
                   var selectedIds=   theForm.music[i].id.substring(3,theForm.music[i].id.length);
                    c_value = c_value + selectedIds+",";              
                }
            }
        }
        if((theForm.music != null)&&(c_value ==""))
        {
            if (theForm.music.checked)
            {  
               var selectedIds=   theForm.music.id.substring(3,theForm.music.id.length);
                c_value = c_value + selectedIds+",";              
            }
        } 
         if(theForm.standard != null)
         {
            for (var i=0; i < theForm.standard.length; i++)
            {            
                if (theForm.standard[i].checked)
                {  
                   var selectedIds=   theForm.standard[i].id.substring(3,theForm.standard[i].id.length);
                    S_value = S_value + selectedIds+",";              
                }
            }
        }
        if((theForm.standard != null)&&(c_value ==""))
        {
            if (theForm.standard.checked)
            {  
               var selectedIds=   theForm.standard.id.substring(3,theForm.standard.id.length);
                S_value = S_value + selectedIds+",";              
            }
        }          
            
        if(c_value=="" && S_value=="")
        {
          alert("Please select atleast one item");
          isValidated=false;
        }
        else
        {
            document.getElementById("ctl00_ContentPlaceHolder1_hdnCompIds").value= c_value+S_value;      
        }
    }  
    return isValidated;
}

function validate_requiredTitle()
{
    with (document.getElementById('ctl00_ContentPlaceHolder1_ddlTitle'))
    {
          if (value==null||value==""||value=="--Select--"||value=="Select")
          {
           createerrordiv(document.getElementById('ctl00_ContentPlaceHolder1_ddlTitle'))
           return false;
          }
          else
          { 
           collapsediv(document.getElementById('ctl00_ContentPlaceHolder1_ddlTitle'))                       
             return true;
          }
    }
}

function validate_requiredCountry()
{
    with (document.getElementById('ctl00_ContentPlaceHolder1_ddlCountry'))
    {
          if (value==null||value==""||value=="--Select--"||value=="Select")
          {
           createerrordiv(document.getElementById('ctl00_ContentPlaceHolder1_ddlCountry'))
           return false;
          }
          else
          { 
           collapsediv(document.getElementById('ctl00_ContentPlaceHolder1_ddlCountry'))                       
             return true;
          }
    }
}

function validate_requiredtxtEmail()
{

    with (document.getElementById('ctl00_ContentPlaceHolder1_txtEmail'))
    {
          if (value==null||value==""||value=="Enter Email")
          {
           createerrordiv(document.getElementById('ctl00_ContentPlaceHolder1_txtEmail'))
           return false;
          }
          else
          { 
            var emailExpression  = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
            
            var element = document.getElementById('ctl00_ContentPlaceHolder1_txtEmail');
            if(emailExpression.test(element.value))
            {
               collapsediv(document.getElementById('ctl00_ContentPlaceHolder1_txtEmail'))   
                return true;
            }
            else
            {
               createEmaildiv(document.getElementById('ctl00_ContentPlaceHolder1_txtEmail'))
               return false;
            }
 
        
          }
    }
}

function validate_requiredtxtFullName()
{
    with (document.getElementById('ctl00_ContentPlaceHolder1_txtFullName'))
    {
          if (value==null||value=="")
          {
           createerrordiv(document.getElementById('ctl00_ContentPlaceHolder1_txtFullName'))
           return false;
          }
          else
          { 
           collapsediv(document.getElementById('ctl00_ContentPlaceHolder1_txtFullName'))                       
             return true;
          }
    }
}

function validate_requiredtxtCity()
{
    with (document.getElementById('ctl00_ContentPlaceHolder1_txtCity'))
    {
          if (value==null||value=="")
          {
           createerrordiv(document.getElementById('ctl00_ContentPlaceHolder1_txtCity'))
           return false;
          }
          else
          { 
           collapsediv(document.getElementById('ctl00_ContentPlaceHolder1_txtCity'))                       
             return true;
          }
    }
}

function validate_requiredtxtEnquiry()
{
    with (document.getElementById('ctl00_ContentPlaceHolder1_txtEnquiry'))
    {
          if (value==null||value=="")
          {
           createerrordiv(document.getElementById('ctl00_ContentPlaceHolder1_txtEnquiry'))
           return false;
          }
          else
          {   
            collapsediv(document.getElementById('ctl00_ContentPlaceHolder1_txtEnquiry'))       
             return true;
          }
    }
}
function validate_requiredtxtVerify()
{
    with (document.getElementById('ctl00_ContentPlaceHolder1_txtVerify'))
    {
          if (value==null||value=="")
          {
           createerrordiv(document.getElementById('ctl00_ContentPlaceHolder1_txtVerify'))
           return false;
          }
          else
          {   
            collapsediv(document.getElementById('ctl00_ContentPlaceHolder1_txtVerify'))       
             return true;
          }
    }
}

//create error div for  validation (SEO point of view) 
function createerrordiv(elementID)
{

    var errorSpanId = elementID.id + "_errorSpan"    
    var errorSpan = document.getElementById(errorSpanId);    
    if(errorSpan !=null)
    {
        elementID.parentNode.removeChild(errorSpan);
    } 
        errorSpan = document.createElement('div');
        errorSpan.id = errorSpanId;     
        if( elementID.attributes["title"])
        {
            errorSpan.innerHTML = elementID.attributes["title"].value;
        }
        else
        {
            errorSpan.innerHTML =  "Enter Value";    
        }       
        errorSpan.className = 'error_field';
        errorSpan.style.textAlign = 'left';
        errorSpan.style.zIndex = elementID.style.zIndex + 1;
        elementID.parentNode.insertBefore( errorSpan, elementID.nextSibling); 
 
    errorSpan.style.display = 'block';
}

//collapse error div for  validation (SEO point of view) 
function collapsediv(elementID)
{
    var errorSpanId = elementID.id + "_errorSpan"
    var errorSpan = document.getElementById(errorSpanId);
    if(errorSpan!=null)
    {
            errorSpan.style.display = 'none';
    }
};
//End of validation SEO point of view 
function createEmaildiv(elementID)
{
    var errorSpanId = elementID.id + "_errorSpan"    
    var errorSpan = document.getElementById(errorSpanId);    
    if(errorSpan !=null)
    {
        elementID.parentNode.removeChild(errorSpan);
    } 
        errorSpan = document.createElement('div');
        errorSpan.id = errorSpanId;     
//        if( elementID.attributes["title"])
//        {
//            errorSpan.innerHTML = elementID.attributes["title"].value;
//        }
//        else
//        {
            errorSpan.innerHTML =  "Enter Valid Email";    
      //  }       
        errorSpan.className = 'error_field';
        errorSpan.style.textAlign = 'left';
        errorSpan.style.zIndex = elementID.style.zIndex + 1;
        elementID.parentNode.insertBefore( errorSpan, elementID.nextSibling); 
 
    errorSpan.style.display = 'block';
}


function OA_adjs(z)
{

   document.MAX_ct0 ='INSERT_CLICKURL_HERE';

   var m3_u = (location.protocol=='https:'?'https://www.vertadnet.com/display/www/delivery/ajs.php':'http://www.vertadnet.com/display/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<script type='text/javascript' src='"+m3_u);
   document.write ("?zoneid="+ z);
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
       document.write ("&amp;ct0=" + escape(document.MAX_ct0));
   }
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/script>");
}
