﻿
function dragStart()
{
  
}  
 function ShowData()
    {    
         var chkStatus= document.getElementById("tdLeft").style.display;            
         if(chkStatus.toLowerCase() == "none")                             
             document.getElementById("tdLeft").style.display="inline";  
         else
             document.getElementById("tdLeft").style.display="none";  
    }     
    
    function changeColor(color)
        {
          //document.getElementById('x').style.background=color;gradientOrange
          if(color == "#23c8a0")
          document.getElementById('x').className = "gradientGreen";
          else if(color == "#ffae4f")
          document.getElementById('x').className = "gradientOrange";
          else if(color == "#4888c0")
          document.getElementById('x').className = "gradientBlue";
        }
//        function changeColor(color)
//        {
//          document.getElementById('x').style.background=color;
//        }
     function blinklink()
        {
        if (!document.getElementById('blink').style.color)
            {
            document.getElementById('blink').style.color="red";
            }
        if (document.getElementById('blink').style.color=="red")
            {
            document.getElementById('blink').style.color="black";
            }
        else
            {
            document.getElementById('blink').style.color="red";
            }
        timer=setTimeout("blinklink()",500);
        }

        function stoptimer()
        {
        clearTimeout(timer);
        }
       
       
       //Home Get Quotes./////////////
         function trimall(sString) 
        {
            if(sString.length==1)
            {
	        while (sString.substring(0,1) ==" ")
	        {
	        sString = sString.substring(1, sString.length);
	        }
	        while (sString.substring(sString.length-1, sString.length) == ' ')
	        {
	        sString = sString.substring(0,sString.length-1);
	        }
	        }
	        return sString;
        }
    function ReplaceAll(Source,stringToFind,stringToReplace)
         {
          var temp = Source;
            var index = temp.indexOf(stringToFind);
                while(index != -1){
                    temp = temp.replace(stringToFind,stringToReplace);
                    index = temp.indexOf(stringToFind);
                }
                return temp;
        }
     function HideImage()
        {
            document.getElementById('LoadIMGInner').style.display = "none";
        }
        function ShowImage(evt)
        {    
        if(trimall(document.getElementById('txt_CompName').value)=="")
        document.getElementById('LoadIMGInner').style.display = "none";  
         else
         {
        if (ReplaceAll(document.getElementById('txt_CompName').value,"  ","").length >= 2)
            document.getElementById('LoadIMGInner').style.display = "inline";                
        else
            document.getElementById('LoadIMGInner').style.display = "none";                
         }
        }
    function checkspace()
    {
       document.getElementById('txt_CompName').value=trimall(document.getElementById('txt_CompName').value);
    }
    function HideImage()
    {
        document.getElementById('LoadIMGInner').style.display = "none";
    }

    function txtempty()
    {
	    if(document.getElementById('txt_CompName').value=="Enter Company name")	
		    document.getElementById('txt_CompName').value="";
    }
    function Schemefill()
    {   
        if(document.getElementById('txt_CompName').value=="")
        {	   
  		    document.getElementById('txt_CompName').value="Enter Company name";  
  	    }
  	}	
  	function validations()
{
    var CompName = document.getElementById('txt_CompName').value;
    if(trimall(CompName) =="" || trimall(CompName)=="Enter Company name")
    {        
        alert("Please Enter Company Name");
        document.getElementById('txt_CompName').focus();
        return false;
    }
    else if(trimall(CompName) !="")
    {
       if(trimall(CompName).length <3)
        {
            alert("Please Enter atleast 3 characters of the Company Name");
            document.getElementById('txt_CompName').focus();
            return false;
        }        
    }
    return true;
}

var XmlHttType;
var Type;
function CreateXmlHttType()
{
	try
	{
		XmlHttType = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttType = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttType = null;	
		}
	}				
	if(!XmlHttType && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttType = new XMLHttpRequest();
	}
}

function getType(State,City)
{
    //var State1 = State.value;
    //alert(City); 
    CreateXmlHttType();	
	document.body.style.cursor = "progress";
	var requestUrl = "/Static/FillBrranch.aspx?State="+State;	
//	alert(requestUrl); 
    if(XmlHttType)
	{
		XmlHttType.onreadystatechange = function(){getTypeResp(City)};
		XmlHttType.open("GET",requestUrl,true);
		XmlHttType.send(null);
	}
}
function getTypeResp(City)
{
	if(XmlHttType.readyState == 4)
	{
		if(XmlHttType.status == 200)
		{
		    
		    var RespData   = document.getElementById(City);
			var strData = XmlHttType.responseText;	
			if(strData != "") 
			{	
				var arrExpDate = strData.split("|");
				RespData.length = 0; 	
				for(i=0; i<arrExpDate.length-1; i++) 
				{								
					    var strDate = arrExpDate[i];
						var arrExpDateCode = strDate.split("~");
						RespData.options[i] = new Option();
						RespData.options[i].value = arrExpDateCode[0];
						RespData.options[i].text = arrExpDateCode[1];
				}
			}
			//document.body.style.cursor = "auto";
			//  document.body.style.cursor = "default";
		}
	}		
}  
function trim(strinput)
       {
        var i;
        while(strinput.charAt(0)==' '||strinput.charAt(0)=='\t'||strinput.charAt(0)=='\n'||strinput.charAt(0)=='\r')
        {
                strinput= strinput.substring(1);
        }
        i = strinput.length-1;
        while(strinput.charAt(i)==' '||strinput.charAt(i)=='\t'||strinput.charAt(i)=='\n'||strinput.charAt(i)=='\r')
        {
                strinput = strinput.substring(0,i);
                i = i-1;
        }
        return strinput;
    }
    
function testForEnterGet(){    
      if (event.keyCode == 13) {  
            event.returnValue=false;
            event.cancel=true;

            if (document.getElementById('imgSiteSearch') != null){
                  document.getElementById('imgSiteSearch').click();
            }
           
      }
 }    
function fillSearch()
{
	var search_text = document.getElementById("Top1_SiteSearch").value;
	if (search_text=="")
	{
	  document.getElementById("Top1_SiteSearch").value="Site Search";
	}
}
	
function emptySearch()
{
	if (trim(document.getElementById("Top1_SiteSearch").value)=="Site Search")
	{
		document.getElementById("Top1_SiteSearch").value="";
	}
}
 function fnsubmit()
    {
        var search_text = document.getElementById("Top1_SiteSearch").value;
        if(trim(search_text) == "" || trim(search_text) == "Site Search")
        {
	        alert("Enter Search Text");
	        return false;
        }
        else
        {
        //var url="/SiteSearch/10/0/"+escape(search_text);
        var url="/SiteSearch.aspx?next=10&old=0&search="+escape(search_text);
        document.location=url;
        }
    }

/////////////////For Inner Page 
function fillSearchInn()
{
	var search_text = document.getElementById("ctl00_TopInner1_SiteSearch").value;
	if (search_text=="")
	{
	  document.getElementById("ctl00_TopInner1_SiteSearch").value="Site Search";
	}
}
	
function emptySearchInn()
{
	if (trim(document.getElementById("ctl00_TopInner1_SiteSearch").value)=="Site Search")
	{
		document.getElementById("ctl00_TopInner1_SiteSearch").value="";
	}
}
 function fnsubmitInn()
    {
        var search_text = document.getElementById("ctl00_TopInner1_SiteSearch").value;
        if(trim(search_text) == "" || trim(search_text) == "Site Search")
        {
	        alert("Enter Search Text");
	        return false;
        }
        else
        {
        //var url="/SiteSearch/10/0/"+escape(search_text);
        var url="/SiteSearch.aspx?next=10&old=0&search="+escape(search_text);
        document.location=url;
        }
    }
