function CheckDomainSelect()
{
	if(document.getElementById('merchant').value == '')
	{
		alert("Please select merchant");
		return false;
	}		 
	for (j=0; j < document.getElementsByName('SubDomain').length; j++)
	{
    		if (document.getElementById("SubDomain"+ j).checked == true)
		{
			var Domain = document.getElementById("SubDomain"+ j).value;
			if(Domain == 'Domain')
				Domain = 'Domain';
			else if(Domain == 'SubDomain')
				Domain = 'SubDomain';
				
			break;
			 
		}
  	}
			 
	if(typeof(Domain) != 'undefined')
	{
		Domain = Domain;
		//var SubDomain=document.getElementById('SubDomain').checked;
		var merchant	=	document.getElementById('merchant').value;
		document.getElementById("leftdiv_id").setAttribute("class", "");
		//document.location="siteStep2.php?domain="+Domain+"&merchant="+merchant;
		$('#divright').hide();
		getsiteStep2();//Calling Ajax Function
	}
	else
	{

		document.getElementById('ErrorMesg').innerHTML = "<font color=red>Please select one option</font>";
		return false;
	}
			     
}

function open_win()
{
   window.open('help.html','welcome','width=800,height=400,scrollbars=yes,screenX=150,screenY=150,left=150,top=200');
}
function open_win_help()
{
	window.open('help_domain.html','welcome','width=500,height=200,scrollbars=yes,screenX=150,screenY=150,left=150,top=200');
	document.getElementById('merchant').value = 0;
	document.getElementById('ErrorMesg').innerHTML='';
}
function subd_win()
{
	document.getElementById('merchant').value = 0;
	document.getElementById('ErrorMesg').innerHTML='';
}

   function isInteger (s)
   {
      var i;

      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }

      return true;
   }

   function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
   }

   function isDigit (c)
   {
      return ((c >= "0") && (c <= "9"))
   }

   
   function loading()
{
 
  document.getElementById("displayname").style.display="block";
 }
   
   

	function check_form_domain()
	{	
	var str = "Please fill the following fields:\t";
          var flg = 1;
             if(((document.getElementById("pid").value)=="") || ((document.getElementById("pid").value)=="0")){
                    str += "\nPid";
                    flg = 0;
            }
           if((document.getElementById("domain").value)==""){
                    str += "\nDomain Name";
                    flg = 0;
            }
			/* if((document.getElementById("username").value)==""){
                    str += "\nUser Name";
                    flg = 0;
            }*/
            if((document.getElementById("email").value)==""){
                    str += "\nEmail";
                    flg = 0;
            
            }
            if((document.getElementById("sitetitle").value)==""){
                        str += "\nSite Title";
                        flg = 0;
                
                }

          	 
				 if(isInteger(document.getElementById("pid").value) == false)
					{
					alert("Affiliate PID must be an integer");
					return false;
					}
       
                
               
                 
                if(flg == 0){
                            alert(str);
                            return false;
                    } 
					 loading();   
    } 


	function check_form_subdomain()
	{	
	var str = "Please fill the following fields:\t";
          var flg = 1;
             if(((document.getElementById("pid").value)=="") || ((document.getElementById("pid").value)=="0")){
                    str += "\nPid";
                    flg = 0;
            }
           if((document.getElementById("subdomain").value)==""){
                    str += "\nSub Domain Name";
                    flg = 0;
            }
		/*	if((document.getElementById("username").value)==""){
                    str += "\nUser Name";
                    flg = 0;
            }*/
            if((document.getElementById("email").value)==""){
                    str += "\nEmail";
                    flg = 0;
            
            }
            if((document.getElementById("sitetitle").value)==""){
                        str += "\nSite Title";
                        flg = 0;
                
                }

          	 
				 
                if(isInteger(document.getElementById("pid").value) == false)
					{
					alert("Affiliate PID must be an integer");
					return false;
					}
       
               
                 
                if(flg == 0){
                            alert(str);
                            return false;
                    } 
					 loading();   
    } 


//Javascript for error report
	function check_form()
	{	
	var str = "Please fill the following fields:\t";
          var flg = 1;
             
           if((document.getElementById("name").value)==""){
                    str += "\nName";
                    flg = 0;
            }
		/*	if((document.getElementById("username").value)==""){
                    str += "\nUser Name";
                    flg = 0;
            }*/
            if((document.getElementById("email").value)==""){
                    str += "\nEmail";
                    flg = 0;
            
            }
            if((document.getElementById("error_report").value)==""){
                        str += "\nComments";
                        flg = 0;
                
                }

          	 
				 
                
               
                 
                if(flg == 0){
                            alert(str);
                            return false;
                    } 
					 //loading();   
    } 



