// JavaScript Document
function submitForm() {

    this.action = window.location.href;
	
}
function submitform()
{
	var rate = document.getElementById('rating');
	var comment = document.getElementById('review_comment');
	if((comment.value.length == 0) && (rate.value.length == 0 )){
		alert('Please Fill In The Product Review And Rate The Product...Thanks');
		comment.focus(); // set the focus to this input
		
	}else if(rate.value.length == 0){
		alert('Please Rate The Product...Thanks');
		rate.focus(); // set the focus to this input
		
	}
	else if(comment.value.length == 0){
		alert('Please Fill In The Product Review...Thanks');
		comment.focus(); // set the focus to this input
		
	}else 
	{	
    document.forms["reviewForm"].submit();
	}
}
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
else
document.getElementById('remLen').value = 160 - obj.value.length;
}
window.onload = function() {
    document.reviewForm.onsubmit = submitForm;
	document.getElementById('review_hide').style.display = 'none'; 
	document.getElementById('review_writeForm').style.display = 'none'; 
	
}
//-->
function writereview()
{
document.getElementById('review_write').style.display = 'none'; 
document.getElementById('review_writeForm').style.display = ''; 
document.getElementById('review_hide').style.display = ''; 
//document.getElementById('review_writeForm').style.display = "relative";
}
function hidereview()
{
document.getElementById('review_write').style.display = ''; 
document.getElementById('review_writeForm').style.display = 'none'; 
document.getElementById('review_hide').style.display = 'none'; 
}
function viewmore()
{
document.getElementById('viewmore_review').style.display = ''; 
document.getElementById('reviewall').style.display = 'none'; 

}
function starout() 
{
document.getElementById('star1').src = template_location + "/images/star.jpg";
document.getElementById('star2').src = template_location + "/images/star.jpg";
document.getElementById('star3').src = template_location + "/images/star.jpg";
document.getElementById('star4').src = template_location + "/images/star.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('rating').value = document.getElementById('ratingt').value;
stars(document.getElementById('ratingt').value)
}
function star(star) 
{
document.getElementById('star1').setAttribute("onmouseout", "starout()");
document.getElementById('star2').setAttribute("onmouseout", "starout()");
document.getElementById('star3').setAttribute("onmouseout", "starout()");
document.getElementById('star4').setAttribute("onmouseout", "starout()");
document.getElementById('star5').setAttribute("onmouseout", "starout()");
ddl = document.getElementById('rating');
ddl.value = "" ;
if(star==1)
{
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star.jpg";
document.getElementById('star3').src = template_location + "/images/star.jpg";
document.getElementById('star4').src = template_location + "/images/star.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML = "Hate It";

}
else if(star==2)
{
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star-orange.jpg";
document.getElementById('star3').src = template_location + "/images/star.jpg";
document.getElementById('star4').src = template_location + "/images/star.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML = "Don't Like It";

}
else if(star==3)
{
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star-orange.jpg";
document.getElementById('star3').src = template_location + "/images/star-orange.jpg";
document.getElementById('star4').src = template_location + "/images/star.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML = "It's Ok";
}
else if(star==4)
{
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star-orange.jpg";
document.getElementById('star3').src = template_location + "/images/star-orange.jpg";
document.getElementById('star4').src = template_location + "/images/star-orange.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML =  "It's Good";
}
else if(star==5)
{
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star-orange.jpg";
document.getElementById('star3').src = template_location + "/images/star-orange.jpg";
document.getElementById('star4').src = template_location + "/images/star-orange.jpg";
document.getElementById('star5').src = template_location + "/images/star-orange.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML = "It's Great";

}

}
function stars(star) 
{


ddl = document.getElementById('rating');
ddl.value = star ;
document.getElementById('ratingt').value = star; 
if(star==1)
{
document.getElementById('star1').setAttribute("onmouseout", "");
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star.jpg";
document.getElementById('star3').src = template_location + "/images/star.jpg";
document.getElementById('star4').src = template_location + "/images/star.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML = "Hate It";

}
else if(star==2)
{
document.getElementById('star2').setAttribute("onmouseout", "");
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star-orange.jpg";
document.getElementById('star3').src = template_location + "/images/star.jpg";
document.getElementById('star4').src = template_location + "/images/star.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML = "Don't Like It";

}
else if(star==3)
{
document.getElementById('star3').setAttribute("onmouseout", "");
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star-orange.jpg";
document.getElementById('star3').src = template_location + "/images/star-orange.jpg";
document.getElementById('star4').src = template_location + "/images/star.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML = "It's Ok";
}
else if(star==4)
{
document.getElementById('star4').setAttribute("onmouseout", "");
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star-orange.jpg";
document.getElementById('star3').src = template_location + "/images/star-orange.jpg";
document.getElementById('star4').src = template_location + "/images/star-orange.jpg";
document.getElementById('star5').src = template_location + "/images/star.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML =  "It's Good";
}
else if(star==5)
{
document.getElementById('star5').setAttribute("onmouseout", "");
document.getElementById('star1').src = template_location + "/images/star-orange.jpg";
document.getElementById('star2').src = template_location + "/images/star-orange.jpg";
document.getElementById('star3').src = template_location + "/images/star-orange.jpg";
document.getElementById('star4').src = template_location + "/images/star-orange.jpg";
document.getElementById('star5').src = template_location + "/images/star-orange.jpg";
document.getElementById('starcaption').innerHTML = '';
document.getElementById('starcaption').innerHTML = "It's Great";

}

}

