﻿
    
    function openURL()
    {
        var sURL="BrokenLinkReport.aspx?";
        window.open(sURL,null,"Width=550px,Height=375px,scroll=yes,help=no,resizable=no,status=no");
        //window.open(sURL,null,"Width=825px,Height=702px,scroll=yes,help=no,resizable=no,status=no");
    }
    
    function setCurrentPageIndex(indx)
    {
        if(event.shiftKey){return false;}
            document.getElementById("hdnPageIndex").value = indx;
        return true;
    }
    
    function SetDefaultCategory(sSubCategoryID)
    {
        var objHdnSubCategoryId=document.getElementById("hdnSubCategoryID");
        var objBtnGetData=document.getElementById("btnGetData");

        var objOutput = document.getElementById('hdnOutput');        
        
        if(objHdnSubCategoryId!=null)
        {
            objHdnSubCategoryId.value=sSubCategoryID;
            objOutput.value = sSubCategoryID;
        }

        var objLinkID = document.getElementById('hdnLinkID');
        var objRowNo = document.getElementById('hdnRowNo');
        var objTopRowNo = document.getElementById('hdnTopRowNo');
        var objPageIndex = document.getElementById('hdnPageIndex');
        var objTopPageIndex = document.getElementById('hdnTopPageIndex');
        var objPageCount = document.getElementById('hdnPageCount');        
             
         if(objLinkID != null && objRowNo != null && objTopRowNo != null && objPageIndex != null && objTopPageIndex != null && objPageCount != null)
         {   
            objLinkID.value = "";
            objRowNo.value = "0";
            objTopRowNo.value = "0";
            objPageIndex.value = "0";
            objTopPageIndex.value = "0";
            objPageCount.value = "0";
        }
        if(objBtnGetData!=null)
            objBtnGetData.click();

        return false;
    } 

    function ShowLayerPage(s)
    {
        var browserName = navigator.appName;

        var tdid = document.getElementById("td_"+s);
        var trDataid = document.getElementById("trData_"+s);
        var imgPlusMinus = document.getElementById("img_"+s);
        
        if(tdid != null)
        {
	        if(browserName == "Microsoft Internet Explorer")
	        {
		        if(trDataid.style.display == 'block')
		        {
			        trDataid.style.display = 'none';
			        imgPlusMinus.src = 'Images/plus.gif';
			        
		        }
		        else
		        {
			        imgPlusMinus.src = 'Images/minus.gif';
			        trDataid.style.display='block';
		        }
	        }
	        else
	        {
		        if(browserName == "Netscape")
		        {
			        if(trDataid.style.display == '')
			        {
				        trDataid.style.display = 'none';
				        imgPlusMinus.src = 'Images/plus.gif';
			        }
			        else
			        {
				        imgPlusMinus.src = 'Images/minus.gif';
			            trDataid.style.display='';
			        }
		        }
	        }
        }
        
    }
    
    function openURL(sURL_Type)
    {
        if(sURL_Type == "BR")
        {
            var sURL="SitePages/BrokenLinkReport.aspx";
            window.open(sURL,null,"Width=500px,Height=340px,scroll=yes,help=no,resizable=no,status=no");
        }
        else if(sURL_Type == "SS")
        {
            var sURL="SitePages/SiteSubmission.aspx";
            window.open(sURL,null,"Width=500px,Height=470px,scroll=yes,help=no,resizable=no,status=no");
        }
    }
    
    
    function OnCountrySelect(obj)
    {
        var objTxtOther=document.getElementById("m_txtOther");
        if(obj!=null && obj.value=="-1"&& objTxtOther!=null)
        {
            objTxtOther.style.display="block";
            objTxtOther.focus();
        }
        else if(objTxtOther!=null)
            objTxtOther.style.display="none";
    }

    function Validation(obj)
    {
        var objTxtName  = document.getElementById("m_txtName");
        var objtxtEmailID = document.getElementById("m_txtEmailId");
        var objtxtCompanyName = document.getElementById("m_txtCompneyName");
        
        var objddlCountryName = document.getElementById("m_ddlCountry");
        var objtxtOtherCountryName = document.getElementById("m_txtOther ");

        var objtxtPhoneNo = document.getElementById("m_txtPhNo");
        var objtxtMobileNo =document.getElementById("m_txtMobNo");
        
        var WebSiteName =document.getElementById("m_txtWebSiteName");
        var objtxtWebSiteUrl = document.getElementById("m_txtWebSiteURL");
        var WebsiteDescription = document.getElementById("m_txtWebSiteDesc");

        var objddlCatgeory = document.getElementById("ddlCatgeory");
        
        TrimString(objTxtName);
        TrimString(objtxtEmailID);
        TrimString(objtxtCompanyName);
        
        if(objtxtOtherCountryName != null)
            TrimString(objtxtOtherCountryName);
        TrimString(objtxtPhoneNo);
        TrimString(objtxtMobileNo);
        
        TrimString(WebSiteName);
        TrimString(objtxtWebSiteUrl);
        TrimString(WebsiteDescription);

           //if(objCountryCode!=null && objCountryCode.value!="")
         
        if(objTxtName!=null && objTxtName.value=="")
        {   
            window.alert( "Please Enter your Name");
            objTxtName.focus(); 
            return false;   
        }

        if(objtxtCompanyName != null && objtxtCompanyName.value== "" )
        { 
            window.alert ("Please Enter The Company Name."); 
            objtxtCompanyName.focus();
            return false; 
        }

        if (objtxtEmailID != null && objtxtEmailID.value == "" )
        {
            window.alert("Please enter valid email Id." ); 
            objtxtEmailID.focus(); 
            return false ;
        }
        else if(objtxtEmailID != null && CheckEmail(objtxtEmailID) == false)
        {
            objtxtEmailID.focus();
            return false; 
        }
        
        if(objddlCountryName.selectedIndex == 0)
        {
            window.alert("Please select Country.");
            objddlCountryName.focus();
            return false; 
        }
        
         if(objddlCountryName != null && objddlCountryName.value== "-1" )
        {             
            if( objtxtOtherCountryName != null && objtxtOtherCountryName.value=="" )
            {  
                window.alert("Please enter the Country name." );  
                objtxtOtherCountryName.focus(); 
                return false;
            }
        }
        
        if(objddlCatgeory.selectedIndex == 0)
        {
            window.alert("Please select Category.");
            objddlCatgeory.focus();
            return false; 
        }
        
        if( objtxtPhoneNo != null && objtxtPhoneNo.value == "")
        { 
            window.alert("Please enter Phone number." );
            objtxtPhoneNo.focus();
            return false;
        }
            
        if( objtxtMobileNo != null && objtxtMobileNo.value== "")
        { 
            window.alert("Please enter Mobile number." ); 
            objtxtMobileNo.focus();
            return false; 
        }

        if( WebSiteName != null && WebSiteName.value == "" )
        {
            window.alert("Please enter Website name.");
            WebSiteName.focus();
            return false ;
        }

        if(objtxtWebSiteUrl != null && objtxtWebSiteUrl.value == "" )
        {
            window.alert("Please enter Website URL." );
            objtxtWebSiteUrl.focus();
            return false ;
        }
        else if(objtxtWebSiteUrl!=null && ValidateURL(objtxtWebSiteUrl.value)==false)
        {
            window.alert('Please enter valid URL.');
            objtxtWebSiteUrl.focus();
            return false;
        }

        if(WebsiteDescription !=null &&  WebsiteDescription.value == "")
        {
            window.alert("Please enter Website Description ");
            WebsiteDescription.focus();
            return false ;
        }
        
        return true ;
   }
 

    
