/*  Project Name		: pamperyourdog
   	Program name		: rate_product.js
 	Program function	: Javascript page for product rating.
	Author				: David Bishop(Jaisenan)
	Developed by	   	: BishopWebWorks, Inc.  - www.bishopwebworks.com 
 	Created Date  		: 15 Nov, 2007
 	
	Update History
    -------------------------------------------------------------------
        Date       		By 					short desc. of what updated 
 	---------------------------------------------------------------------*/
function validate_email(theform){
//alert("dhfsdksd");
	if(theform.frm_name.value ==""){
		alert("Please enter your name");
		theform.frm_name.focus();
		return false;
	}
	if(theform.frm_email1.value ==""){
		alert("Please enter your email");
		theform.frm_email1.focus();
		return false;
	}
	if(!emailCheck(theform.frm_email1.value)){
		alert("Please enter a valid email");
		theform.frm_email1.focus();
		return false;
	}
	if(theform.frm_email2.value ==""){
		alert("Please enter recipients email address");
		theform.frm_email2.focus();
		return false;
	}
	if(!emailCheck(theform.frm_email2.value)){
		alert("Please enter a valid email");
		theform.frm_email2.focus();
		return false;
	}
	return true;
}
function CancelFunct(){//alert("dhfsdksd");
document.getElementById("email_friend").innerHTML = '';
document.getElementById("hidn_contnt").style.display="none";
}
function EmailToFriend(){
	var prod_name = document.getElementById("prod_name").value;
		var id = document.getElementById("prod_id").value;
	var cont = '<form action="./product_detail.php" method="post" onsubmit="return validate_email(this)"><table border="0" cellpadding="1" cellspacing="1" bgcolor="#fd007e" width="100%"><tr><td bgcolor="#fff2f9"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td height="8" align="left"  colspan="2"></td></tr><tr><td align="left" class="style13"  colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;Send "'+prod_name+'"to a friend</td></tr>';
			cont += '<tr><td colspan="2" height="5"><input type="hidden" name="prod_id" value="'+id+'">&nbsp;</td> </tr>';
			cont +=	'<tr><td align="right" class="style6" width="35%" valign="top">&nbsp;&nbsp;Your Name&nbsp;:&nbsp;</td><td width="65%" valign="top"><input type="Text" name="frm_name" value=""></td></tr>';
			cont += '<tr><td colspan="2" height="5"></td> </tr>';
			cont += '<tr><td align="right" class="style6" width="35%" valign="top">Your Email&nbsp;:&nbsp;</td><td><input type="Text" name="frm_email1" value=""></td></tr>'
			cont += '<tr><td colspan="2" height="5"></td> </tr>';
			cont += '<tr><td align="right" class="style6" width="35%" valign="top">Recipients Email&nbsp;:&nbsp;</td><td><input type="Text" name="frm_email2" value=""></td></tr>'
			cont +='<tr><td align="right" height="5" colspan="2"></td></tr>';
			cont +='<tr><td align="right" valign="bottom" width="50%"><input type="Submit" name="btn_email" class="text" value="Submit"></td><td align="left" valign="bottom" width="50%">&nbsp;<input type="Button" name="btn_cancel" class="text" value="Cancel" onclick="CancelFunct()"></td></tr>';
			cont +='<tr align="center" valign="bottom"><td height="8" align="left" colspan="2">&nbsp;</td></tr></table></td></tr></table></form>';
	document.getElementById("email_friend").innerHTML = cont;
	document.getElementById("hidn_contnt").style.display="block";
	
} 