/*  Project Name		: pamperyourdog
   	Program name		: Product_review.js
 	Program function	: Javascript page for product review.
	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_rev(theform){

	if(theform.frm_name.value ==""){
		alert("Please enter your name");
		theform.frm_name.focus();
		return false;
	}
	if(theform.frm_message.value ==""){
		alert("Please enter your message");
		theform.frm_message.focus();
		return false;
	}
	if(theform.word.value ==""){
		alert("Please enter the word");
		theform.word.focus();
		return false;
	}
	if(!IsInteger(theform.word.value)){
		    alert("Please Enter valid word");
			theform.word.focus();
			return false;
		}
	return true;
}
function CanceFunct(){
document.getElementById("prod_rev").innerHTML = '';
document.getElementById("hidn_contnt").style.display="none";
}
function ProductReview(){
	var prod_name = document.getElementById("prod_name").value;
	var id = document.getElementById("prod_id").value;
	var cont = '<form action="./product_detail.php#prod_review" method="post" onsubmit="return validate_rev(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;Write a review about "'+prod_name+'"</td></tr>';
			cont +='<tr><td colspan="2"><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" valign="top">&nbsp;&nbsp;Your Message&nbsp;:&nbsp;</td><td valign="top"><textarea name="frm_message" rows="3" style="background-color:#f1c9d8;"></textarea></td> </tr>';
			cont +='<tr><td colspan="2" height="5"></td> </tr>';					
			cont +='<tr><td align="right" class="style6">&nbsp;&nbsp;Enter the number&nbsp;:&nbsp;</td><td valign="top"><input type="text" name="word" size="16" maxlength="5"></td></tr>';
			cont +='<tr><td colspan="2" height="5"></td> </tr>';					
			cont +='<tr><td align="right" width="35%">&nbsp;</td><td align="left" valign="top"><img src="./code.php" width="140" height="40"></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_review" class="text" value="Submit">&nbsp;</td><td align="left" valign="bottom" width="50%">&nbsp;<input type="Button" name="btn_cancel" class="text" value="Cancel" onclick="CanceFunct()" ></td></tr>';
			cont +='<tr><td height="8" align="left" colspan="3">&nbsp;</td></tr></table></td></tr></table></form>';
	
	
	document.getElementById("prod_rev").innerHTML = cont;
	document.getElementById("hidn_contnt").style.display="block";
} 