function sendtofriend() {
// alert (URL);
var URL
URL = location.href;
window.open('sendtofriend.php?page='+URL, 'EmailWindow', 'scrollbars=yes,width=730,height=363');
}

function bookmarksite(){
var myloc = location.href;
var title = "Web Solutions MD";
// check if active
// alert (title+"\r\n"+myloc);
if (document.all)
  window.external.AddFavorite(myloc,title);
else if (window.sidebar)
  window.sidebar.addPanel(title, myloc,"")
}

//onKeyPress="return keyRestrict(event,'1234567890');"
function getKeyCode(e){
	if (window.event)
	   return window.event.keyCode;
	else if (e)
	   return e.which;
	else
	   return null;
}
function keyRestrict(e, validchars){ 
	var key='', keychar='';
	key = getKeyCode(e);
	if (key == null) return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	validchars = validchars.toLowerCase();
	if (validchars.indexOf(keychar) != -1)
		return true;
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
		return true;
	return false;
}


//################################################
//Consultation Sign-up Form
//################################################


function submitForm() {
	eForm = document.emailForm;
	if (eForm.txtName.value=="") {
		alert("Please type in your Full Name.");
		eForm.txtName.focus();
		return;
	}
	else if (CheckEmail(eForm.Email.value)==false) {
		alert("Please check your Email Address.");
		eForm.Email.focus();
		return;
	}
	else if (eForm.txtPhone.value=="") {
		alert("Please type in your home/office phone number.");
		eForm.txtPhone.focus();
		return;
	}
	else if(eForm.txtBesttime.value=="") {
		alert("Please type the Best time to contact you.");
		eForm.txtBesttime.focus();
		return;
	}
	else if (eForm.txtDetails.value=="") {
		alert("Please enter your Project/Business Details.");
		eForm.txtDetails.focus();
		return;
	}
	document.emailForm.action="index.html";
	document.emailForm.submit();
	}

//################################################
//To Check the Email
//################################################

function CheckEmail(Email){
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Email)) {
  return true
 }
 
 return (false)
}

//################################################
//newsandannouncement
//################################################

function newsandannouncement() {

window.open('newsandannouncement.html','EmailWindow', 'scrollbars=yes,width=730,height=363');
}



//################################################
//Consultation Request Form
//################################################


function submitConsult() {
	eForm = document.consultForm;
	if (eForm.txtFname.value=="") {
		alert("Please type in your First Name.");
		eForm.txtFname.focus();
		return;
	}
	else if (eForm.txtLname.value=="") {
		alert("Please type in your Last Name.");
		eForm.txtLname.focus();
		return;
	}
	else if (eForm.txtPhone.value=="") {
		alert("Please type in your home/office phone number.");
		eForm.txtPhone.focus();
		return;
	}
	else if (CheckEmail(eForm.Email.value)==false) {
		alert("Please check your Email Address.");
		eForm.Email.focus();
		return;
	}
	//document.consultForm.action="consulting.php";
	document.consultForm.submit();
	}
	

//################################################
//Became a partner Request Form
//################################################


function submitBecameapartner() {
	eForm = document.becameapartnerForm;
	if (eForm.txtFname.value=="") {
		alert("Please type in your First Name.");
		eForm.txtFname.focus();
		return;
	}
	else if (eForm.txtLname.value=="") {
		alert("Please type in your Last Name.");
		eForm.txtLname.focus();
		return;
	}
	else if (eForm.txtPhone.value=="") {
		alert("Please type in your home/office phone number.");
		eForm.txtPhone.focus();
		return;
	}
	else if (CheckEmail(eForm.Email.value)==false) {
		alert("Please check your Email Address.");
		eForm.Email.focus();
		return;
	}
	document.becameapartnerForm.action="become_partner_form.html";
	document.becameapartnerForm.submit();
	}

//################################################
//Refer Form
//################################################


function submitRefer() {
	eForm = document.referForm;
	if (eForm.txtName1.value=="") {
		alert("Please type in your Name.");
		eForm.txtName1.focus();
		return;
	}
	else if (eForm.txtPhone1.value=="") {
		alert("Please type in your home/office phone number.");
		eForm.txtPhone1.focus();
		return;
	}
	else if (CheckEmail(eForm.Email1.value)==false) {
		alert("Please check your Email Address.");
		eForm.Email1.focus();
		return;
	}
	else if (eForm.txtRelation1.value=="") {
		alert("Please tell us your Relationship.");
		eForm.txtRelation1.focus();
		return;
	}
	else if (eForm.txtName2.value=="") {
		alert("Please tell us your Referred Name.");
		eForm.txtName2.focus();
		return;
	}
	else if (eForm.txtPhone2.value=="") {
		alert("Please tell us your Referred Phone.");
		eForm.txtPhone2.focus();
		return;
	}
	else if (CheckEmail(eForm.Email2.value)==false) {
		alert("Please check the reffered Email.");
		eForm.Email2.focus();
		return;
	}
	else if (eForm.txtService2.value=="") {
		alert("Please type the Services.");
		eForm.txtService2.focus();
		return;
	}
	document.referForm.action="refer_a_friend.html";
	document.referForm.submit();
	}


function openSliderDescription(id){
	window.open('slider-desc.php?id='+id, 'EmailWindow', 'scrollbars=yes,width=800,height=600');
}
function PhoneFormat(me){
	if (me.value.length > 0) {
		var tValue = me.value.replace(new RegExp("-", "gi"), "");
		
		tValue = tValue.substring(0, 3) + '-' + tValue.substring(3, 6) + '-' + tValue.substring(6);
		me.value = tValue;
	}
}

function login(){
	
	if(document.frmlogin.username.value=="" || document.frmlogin.password.value==""){
		alert(" Please enter ALL of the information!");
		
	}
	else{
		document.frmlogin.action="log-in.php";
		document.frmlogin.submit();	
	}
}

//################################################
//Payment Form
//################################################


function submitCart() {
	eForm = document.cartForm;
	if (eForm.txtComp.value=="") {
		alert("Please type in the Company Name.");
		eForm.txtComp.focus();
		return;
	}
	else if (eForm.txtName.value=="") {
		alert("Please type in your Name.");
		eForm.txtName.focus();
		return;
	}
	
	else if (eForm.txtPhone.value=="") {
		alert("Please type in your Contact Number.");
		eForm.txtPhone.focus();
		return;
	}
	
	else if (CheckEmail(eForm.email.value)==false) {
		alert("Please check your Email Address.");
		eForm.email.focus();
		return;
	}
	
	else if (eForm.item_name_1.value=="") {
		alert("Please check the Payment Details");
		eForm.item_name_1.focus();
		return;
	}
	
	else if (eForm.amount_1.value=="") {
		alert("Please check the Payment Amount");
		eForm.amount_1.focus();
		return;
	}
	
document.cartForm.submit();
	}
	
function submit_attach(){
	eForm = document.frmattach;
	if (eForm.txtDescription.value=="") {
		alert("Please type in your SR.");
		eForm.txtDescription.focus();
		return;
	}
	document.emailForm.action="service_request_client.php";
	document.emailForm.submit();
	//eForm.formAction.value = "Submit";
	//eForm.submit();
	}
	
function login_contact(){
	if(document.getElementById("username").value=="" || document.getElementById("password").value==""){
		alert(" Please enter ALL of the information!");
		
	}
	else{
		//document.frmlogin.action="#client_login";
		document.getElementById("frmlogin").submit();	
		
	}
}

