function checkText()
{
	var frm=document.forms["frmMain"];
	if(!frm.user_id.value || frm.user_id.value<=0)
    {
      alert("Sorry !! You have not loged in.\nThis is login restricted section");
	  return false;
    }
    else if(!frm.message_desc.value)
	{
	   alert("You have not entered message");
	   return false;
	}
      frm.submit();
	  return true
}
function Chk(frm)
{
	if(!frm.user_id.value || frm.user_id.value<=0)
    {
      alert("Sorry !! You have not loged in.\nThis is login restricted section");
	  return false;
    }
   return true	
}
function winT()
 {
    var frm=document.forms["frmMain"];
	if(!frm.user_id.value || frm.user_id.value<=0)
    {
      alert("Sorry !! You have not loged in.\nThis is login restricted section");
	  return false;
    }
    else if(!frm.new_board_name.value)
	{
	    alert("You have not enter value");	
	    return false;
    }	
	  return true
 }
function getPage(x,y)
{
  var frm=document.forms["frmMain"];
  frm.board_id.value=x;
  frm.board_name.value=y;
  frm.message_id.value="";
  frm.submit(); 
}
function isEmail(Ml)
{
  if(!Ml){return true}
  if(Ml.indexOf("@")<=0 || Ml.indexOf("@")==Ml.length-1 || Ml.indexOf(".")<=0 || Ml.indexOf(".")==Ml.length-1 || Ml.indexOf("..")!=-1 || Ml.indexOf("@@")!=-1 || Ml.indexOf("@.")!=-1 || Ml.indexOf(".@")!=-1)
  {
      return false
  }
  else
  {
      return true
  }
}

function Trim (s){return LTrim(RTrim(' '+s));}
function LTrim (s)
{
    if(!s){return '';}
    while(s.charAt(0)==' ')
        s = s.substring(1,s.length);
    return s;
}
//..............

function RTrim (s)
{
    if(!s || s==' '){return '';}
    if (s.length > 1)
    {
        while(s.charAt(s.length-1)==' ')
            s = s.substring(0,s.length-2);
        return s;
    }
}
function issValid(frm)
{
	var txt="";
	if(!(frm.name.value))
	{
		txt+="     *Check Name.\n"
	}
	if(!Trim(frm.email.value) || !isEmail(frm.email.value))
	{
		txt+="     *Invalid Email Id\n";
	}
	if(!Trim(frm.password.value) && !Trim(frm.conf_password.value))
	{
	   txt+="     *Password & Confirm password should not be blank.\n"
	} 
	if(frm.password.value.length<4)
	{
	   txt+="     *Password should minimum 4 chars.\n"
	} 
	
	if(Trim(frm.password.value)!==Trim(frm.conf_password.value))
	{
		txt+="     *Password & Confirm Password are not same.\n";
	}
	if(!(frm.office_phone.value))
	{
		txt+="     *Check Office Phone No..\n"
	} 
	if(frm.term.checked==false)
	{
		txt+="     *You did not agree with Terms of Service Agreement.\n"
	}    
   	if(txt)
	{
   		alert("Sorry!! following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function isValid(frm)
{
	var txt="";
	if(!Trim(frm.email.value) || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email Id\n";
	}
	if(!Trim(frm.password.value) && !Trim(frm.conf_password.value))
	{
	   txt+="     Password & Confirm password should not be blank\n"
	} 
	if(frm.password.value.length<4)
	{
	   txt+="     Password should minimum 4 chars\n"
	} 
	
	if(Trim(frm.password.value)!==Trim(frm.conf_password.value))
	{
		txt+="     Password & Confirm Password are not same\n";
	}   
	if(!(frm.zip.value))
	{
		txt+="     Check zip\n"
	}  
	if(frm.term.checked==false)
	{
		txt+="     You did not agree with Terms of Service Agreement\n"
	}    
   	if(txt)
	{
   		alert("Sorry!! following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}

function GetPg(x,y)
{
	var frm = document.forms['link'];
	frm.action=x;
	frm.search_id.value=y;
	frm.target="_self";
	frm.submit();
}
function PopUp(x)
{
	window.open('terms.htm','_new','left=250,top=200,width=600,height=300,scrollbars=yes,addressbar=no');
}
function PopUp1(y)
{
	window.open('privacy-policy.htm','_new','left=250,top=200,width=600,height=300,scrollbars=yes,addressbar=no');
}    
function GetMsg(x)
{
     var frm = document.forms['link'];
	 frm.msg_type.value=x;
	 frm.action="personal_message.php";
	 frm.target="_self";
	 frm.submit();  
}
function isssValid(frm)
{
	var txt="";
	if(!(frm.card_no.value))
	{
		txt+="     *Check Credit Card No..\n"
	}
	if(!(frm.exp_month.value))
	{
		txt+="     *Check Credit Card Expiry Month.\n"
	}
	if(!(frm.exp_year.value))
	{
		txt+="     *Credit Card Expiry Year.\n"
	}
	if(frm.term.checked==false)
	{
		txt+="     *You did not agree with Terms of Service Agreement.\n"
	}    
   	if(txt)
	{
   		alert("Sorry!! following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function issssValid(frm)
{
	var txt="";
	if(frm.term.checked==false)
	{
		txt+="     *You did not agree with Terms of Service Agreement.\n"
	}    
   	if(txt)
	{
   		alert("Sorry!! following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function conValid(frm)
{
	var txt="";
	if(!Trim(frm.email.value) || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email Id\n";
	}
	if(frm.visitor.value==false)
	{
		txt+="     *Check Name.\n"
	}
	if(frm.comments.value==false)
	{
		txt+="     *Check comments.\n"
	} 
   	if(txt)
	{
   		alert("Sorry!! following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}
function clValid(frm)
{
	var txt="";
	if(frm.visitor.value==false)
	{
		txt+="     *Check Name.\n"
	}
	if(!Trim(frm.email.value) || !isEmail(frm.email.value))
	{
		txt+="     Invalid Email Id\n";
	}
	if(frm.comments.value==false)
	{
		txt+="     *Check comments.\n"
	} 
   	if(txt)
	{
   		alert("Sorry!! following errors has been occured :\n\n"+ txt +"\n     Please Check");
  	 	return false
	}
    return true	
}