﻿function noError(){return true;}
        window.onerror = noError;
function isDel()
{
        var i = confirm("Do you want to delete?");
        return i;
}
    
function createCookie(name,value,hours) 
{
	if (hours) {
		var date = new Date();
		date.setTime(date.getTime()+(hours*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
//=================modified on  03-Oct=====================================
     function fadeIn() 
        {
         try
            {
                var bodyStyle=document.body.style;
                if ( bodyStyle.opacity < 1)
                 {
                    bodyStyle.opacity=((bodyStyle.opacity*10)+1)/10; //Add 0.1
                    setTimeout('fadeIn();',50)
                }
              }
            catch(e)
            {
            }   
        }
        fadeIn();  

    function HideAdvertDiv()
    {        
        document.getElementById('AdvertDiv').style.visibility = 'hidden'
    }

    function body_onkeydown() 
    {
        if(event.keyCode==13 || event.keyCode==27) 
        {
            var _defaultButtonName=getDefautButtonName( event.keyCode==13 ?  "LoginBtn" : "CancelBtn");
          
            var frm=document.forms[0];
            if(frm && document.all(_defaultButtonName))
            {
                document.all(_defaultButtonName).click();
            }
        }
    }           
    function ShowLogin()
    {  
       return GB_showCenter('LOGIN', "/Login.htm",500,800);
    }        
    function HideLogin()
    {
        return parent.parent.GB_hide();
    }             
    function HideForgotPwd()
    {
            return parent.parent.GB_hide();  
    }    
    
    function ShowUserStatus()
    {
        HideLogin();
        HideForgotPwd()
        document.getElementById("divback").style.display='block';  
        var LeftPosition,TopPosition,w,h; 
        w=250; h=50; 
        LeftPosition=(screen.width)?(screen.width-w)/2:100+20;
        TopPosition=(screen.height)?(screen.height-h)/2:100;  
        document.getElementById("UserStatus").style.left= LeftPosition + "px";
        document.getElementById("UserStatus").style.top= TopPosition + "px";
        document.getElementById("UserStatus").style.position="absolute";
        document.getElementById("UserStatus").style.display='block';  
        return false;
    }          
    function HideUserStatus()
    {
        document.getElementById("divback").style.display='none';  
        document.getElementById("UserStatus").style.display='none';  
        return false;
    }    

    function SetDivPosition(Element)
    {
        if(isNaN(Element.style.height) || Element.style.height == "")
        {
            objh = 100; 
        }
        else
        {
            objh = parseFloat(Element.style.height)/2; 
        }

        if(isNaN(Element.style.width) || Element.style.width == "")
        {
            objw = 200; 
        }
        else
        {
            objw = (parseFloat(Element.style.width)/2) ; 
        }
        objw = objw + 125;
        Element.style.top = Math.floor(Math.round((document.documentElement.offsetHeight/2)+document.documentElement.scrollTop)-objh)+'px'; 
        Element.style.left = Math.floor(Math.round((document.documentElement.offsetWidth/2)+document.documentElement.scrollLeft)-objw)+'px'; 
    }
    
    function ShowGeneralDiv(msg)
    {
        var obj = document.getElementById("GeneralDiv")
        var objMsg = document.getElementById("GeneralDivMsg")
        
        objMsg.innerHTML = msg;
        obj.style.visibility = "visible"		                
        SetDivPosition(obj)
        document.getElementById("divback").style.visibility = 'visible';        
    }   
    
     function ShowOfferDiv(msg,type)
    {        
        var obj = document.getElementById("OfferDiv")
        var objMsg = document.getElementById("OfferBody")
        if(type=='reg')
        {
            document.getElementById("OfferHead").innerHTML="Registration";
        }
        else
        {
           document.getElementById("OfferHead").innerHTML="Special Offer";
        }
        objMsg.innerHTML = msg;
        obj.style.visibility = "visible"		                
        SetDivPosition(obj)
        document.getElementById("divback").style.visibility = 'visible';          
    }   
    
    function HideOfferDiv()
    {
        document.getElementById('OfferDiv').style.visibility = 'hidden'
        document.getElementById("divback").style.visibility = 'hidden';  
    } 
    
    function HideGeneralDiv()
    {
        document.getElementById('GeneralDiv').style.visibility = 'hidden'
        document.getElementById("divback").style.visibility = 'hidden';  
    } 
    
    function ajaxFunction()
    {  
        var xmlHttp;
        try
        {  
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            try
  	        {   
	            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	        }
	        catch (e)
  	        {    
		        try
    		    { 
				    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			    }
 			    catch (e)
    		    {   
			 	    alert("Your browser does not support AJAX!");   
				    return false;
			    }
 	        }  
        }
        return xmlHttp;
    }
 
 	function AjaxAddWatchList(ID)
    {   
        var xmlHttp = ajaxFunction() ;	 
        xmlHttp.open("GET","/AjaxWatchList.aspx?no="+Math.random()+"&ID="+ID,true);
        xmlHttp.onreadystatechange=function()
        {
            if(xmlHttp.readyState==4)
            {
                var str =  xmlHttp.responseText;                
    	        if (str != "") 
                { 
	                if (str == "True")
	                {	                
	                    ShowGeneralDiv("Company added to watch list successfully.");
                        return false;
	                }
	                else if(str == "login")	              
	                {
	                    ShowLogin();
	                    return false;
	                }	                
    	    	 }
	        }
        }
        xmlHttp.send(null);  
    }
    
     function HidePopup()
    {   
          return parent.parent.GB_hide();
    }

	 function ShowSignupDiv()
    {     
        return GB_showCenter('', "/Register.htm",500,800);
        pageTracker._trackPageview("Signup");
        return false;
    }
    
	  function callAjax()
      {
       var email = document.getElementById("PageHeader1_txtEmailAddress").value; 
       if(email!="")
       {
           var xmlHttp = ajaxFunction() ;
	       xmlHttp.open("GET","/AjaxGet.aspx?no="+Math.random()+"&Email="+email,true);
           xmlHttp.onreadystatechange=function()
           {
              if(xmlHttp.readyState==4)
              {
                 var str =  xmlHttp.responseText;
    	         if (str != "") 
                 {            
	                if (str == "True")
	                {
                        alert("Email id already exits");
                        document.getElementById("PageHeader1_txtEmailAddress").value='';
                        document.getElementById("PageHeader1_txtEmailAddress").focus();
                        return false;
	                }	         
		         }
	           }
           }
           xmlHttp.send(null);  
           }
       }  
	 
     function validNumber(f)
     {    
        var re = /^[0-9]*$/;
        if (!re.test(f.value)) 
        {
            alert("Only numbers allowed!");
            f.value = f.value.replace(/[^0-9]/g,"");
        }
    }
      
    function ok(sender, e)
    {
        $find('ModalPopupExtenderLogin').hide();
        __doPostBack('LoginBtn', e); 
    }
    
    function okJoin(sender, e)
    {
        return false;
    }
    
    function OnKeyPress(args)
    {
        if(args.keyCode == Sys.UI.Key.esc)
        {
            $find("ModalPopupExtenderLogin").hide();
        }
    }
    
     //====================gett offer Day and deactivating registration for that period=========================
    function CheckOffer(strOffer)
    {
		var xmlHttp = ajaxFunction() ;	 
		var Url="/AjaxGetOfferPeriod.aspx?no="+Math.random();
		xmlHttp.open("GET",Url,true);
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var strGetOffer =  xmlHttp.responseText;	
				  var  arrayStr;     
				    var StartDate;             
                    var EndDate;                   
                    var OfferText;   
                    var Download;                 
				    arrayStr = strGetOffer.split('$');  
				    StartDate= arrayStr[0];              
                    EndDate = arrayStr[1];
                    OfferText = arrayStr[2];    
                    Download  = arrayStr[3];
				if(strGetOffer=="False")
				{
                    ShowSignupDiv();
				}
				else
				{      
				   if(strOffer=="reg" && Download !="0")
				   {
			            ShowOfferDiv('Dear User<br/><br/>We have a special offer running currently at ReportJunction.com. During this offer period, registration will remain suspended. Please visit us back after ' + EndDate + ' and get yourself registered. You will be entitled to free site access during next offer period.<br/><br/>Cheers<br/>ReportJunction Team','reg');
			       }
			       else if(strOffer=="reg" && Download =="0")
			       {
			        ShowSignupDiv();
			       }
			       else if(strOffer=="offer")
			       {       	
			        	ShowOfferDiv('Dear Customer,<br/><br/> '+ OfferText + '.<br/><br/>Cheers<br/>ReportJunction Team','sp');			        
			       }
				}									
			}			
		}	
		xmlHttp.send(null);  
		return false;      
}
//================end of function=====================================================================
	    function ShowReferenceTextbox()
        {
            var drpRef=document.getElementById('PageHeader1_drpReference').value;
            if(drpRef=="Others")
            {            
                document.getElementById("PageHeader1_txtReference").style.display='inline';
                document.getElementById("PageHeader1_txtReference").value="";
                document.getElementById("PageHeader1_valrtxtReference").enabled = true;
                document.getElementById("PageHeader1_valrtxtReference").style.display='inline';
                document.getElementById("PageHeader1_valrdrpReference").enabled = false;
            }
            else
            {
                document.getElementById("PageHeader1_txtReference").value='.';
                document.getElementById("PageHeader1_txtReference").style.display='none';
                document.getElementById("PageHeader1_valrtxtReference").enabled = false;
                document.getElementById("PageHeader1_valrtxtReference").style.display='none';
                document.getElementById("PageHeader1_valrdrpReference").enabled = true;
            }
    }
    
    //Home Page
    function checkBlank()
    {
        if(document.getElementById("txtCompanyId").value=="")
        {
            alert("Please enter search keyword");
            document.getElementById("txtCompanyId").focus();
            return false;
        }
        else
            return true;
    }       
     
    function onlineSupport(url_add)
    {
        window.open(url_add,'welcome','width=410,height=500,menubar=yes,status=yes,location=yes,toolbar=no,scrollbars=yes');
    }      
    
    //Report Page ////
      function blinkIt() 
        {
         if (!document.all) return;
             else
              {
                  for(i=0;i<document.all.tags('blink').length;i++){
                  s=document.all.tags('blink')[i];
                  s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
              }
            }
        }
	    function ShowRequestReport()
         {
            var LeftPosition="",TopPosition="",w="",h="";
            w=625; h=280;    
            LeftPosition=(screen.width)?(screen.width-w)/2:100+20;
            TopPosition=(screen.height)?(screen.height-h)/2:100;            
            document.getElementById("RequestReportDiv").style.width= w + "px";
            document.getElementById("RequestReportDiv").style.height = h + "px";
            document.getElementById("RequestReportDiv").style.left= LeftPosition + "px";
            document.getElementById("RequestReportDiv").style.top= TopPosition + "px";
            document.getElementById("divback").style.visibility='visible';        
            document.getElementById("RequestReportDiv").style.position="absolute";
            document.getElementById("RequestReportDiv").style.display='block';
            document.getElementById("RequestReportDiv").style.cursor='pointer'
            document.getElementById("divback").style.display='block';         
            return false;
         }

	    function HideRequestReportDiv(id)
        {
            document.getElementById("txtRequest").value='';    
            document.getElementById("divback").style.display='none';     
            document.getElementById("RequestReportDiv").style.display='none';
            return false;
        }	 
     // End Code Report Page////
     
     //Edit Profile ////////////////   
       animatedcollapse.addDiv('divPassword', 'fade=1,height:100px');
       animatedcollapse.init();
       var _strFlag=0;
       function changePassword()
       {   
            if(_strFlag==0)
            {
                animatedcollapse.show('divPassword');
                _strFlag=1;
            }
            else
            {
                animatedcollapse.hide('divPassword');
                _strFlag=0;        
            }    
       }     
     ////////////////////////////////
   
//============End of Modification===========================
