﻿
function PopReview()
{
	var html = "";
html += "<table  border=\"0\" >";
html += "    <tr>";
html += "        <td colspan=\"2\">";
html += "            <table border=\"0\">";
html += "                <tr valign=\"top\">";
html += "                    <td>";
html += "                        <table border=\"0\">";
html += "                            <tr>";
html += "                                <td style=\"padding:0 35px 0 0\"><span id=\"spnTitle\" style='font-weight:bold;color:#5d235f'>Subject:</span><br /><input id=\"tbTitle\" type=\"text\" style=\"width:175px\" onkeyup=\"document.getElementById('spnTitle').style.color = '#000000'\" /></td>";
html += "                                <td colspan='1'>";
html += "                                    <span id=\"spnRating\" style='font-weight:bold;color:#5d235f'>Rating:</span><br />";
html += "                                    <select id=\"Review1_ddlRating\" style=\"width:100px\" onchange=\"lockStars(this.value);\" onkeyup=\"lockStars(this.value);\">";
html += "                                        <option selected=\"selected\" value=\"0\"></option>";
html += "                                        <option value=\"1\">Poor</option>";
html += "                                        <option value=\"2\">Below Average</option>";
html += "                                        <option value=\"3\">Average</option>";
html += "                                        <option value=\"4\">Good</option>";
html += "                                        <option value=\"5\">Excellent</option>";
html += "                                    </select><br />";
html += "                                    <img alt=\"Poor\" id=\"star-1\" src=\"images/star_gray.gif\" onmouseover=\"return syncStars(1)\" onclick=\"lockStars(1)\" style=\"cursor:pointer\"/>";
html += "                                    <img alt=\"Below Average\" id=\"star-2\" src=\"images/star_gray.gif\" onmouseover=\"return syncStars(2)\" onclick=\"lockStars(2)\" style=\"cursor:pointer\"/>";
html += "                                    <img alt=\"Average\" id=\"star-3\" src=\"images/star_gray.gif\" onmouseover=\"return syncStars(3)\" onclick=\"lockStars(3)\" style=\"cursor:pointer\"/>";
html += "                                    <img alt=\"Good\" id=\"star-4\" src=\"images/star_gray.gif\" onmouseover=\"return syncStars(4)\" onclick=\"lockStars(4)\" style=\"cursor:pointer\"/>";
html += "                                    <img alt=\"Excellent\" id=\"star-5\" src=\"images/star_gray.gif\" onmouseover=\"return syncStars(5)\" onclick=\"lockStars(5)\" style=\"cursor:pointer\"/>";
html += "                                    <span id=\"spnRatings\"></span>";
html += "                                </td>";
html += "                            </tr>";
html += "                        </table>";
html += "                    </td>";
html += "                </tr>";
html += "            </table>";
html += "        </td>";
html += "    </tr>";
html += "    <tr>";
html += "        <td><span id=\"spnReview\" style='font-weight:bold; color:#5d235f'>Your Review</span><br /><textarea id=\"tbReview\" style=\"height:60px; width:310px\" onkeyup=\"document.getElementById('spnReview').style.color = '#000000'\"  ></textarea></td>";
html += "    </tr>";
html += "    <tr>";
html += "        <td align=\"right\" style=\"padding: 10px 0 0 0\"><input id=\"btnPostReview\" type=\"button\" value=\"Post Review\" style=\"width:120px; color:FF7F00; font-weight:bold; font-size:14px\" onclick=\"SendReview()\" /></td>";
html += "    </tr>";
html += "</table>";
document.getElementById('divWriteReview').innerHTML = html;
try
{
    pageTracker._trackEvent("ItemDescription", "Review", itemmanf+ ' ' + itemstyle);
}
catch(err) {}
//html = 'asd';
	
	//alert(html);


}




		var locked = false;
		function syncStars(value) 
		{
			if(locked) return;
			var i;
			for(i=1; i < 6; i++)
			{
				if(i <= value)
				{
					document.getElementById("star-" + i).src = "images/star.gif";
				}
				if(i > value)
				{
					document.getElementById("star-" + i).src = "images/star_gray.gif";
				}
			}	
			document.getElementById('Review1_ddlRating').value = value;
			updateRatingsText(value);
			return false;
		}
		function lockStars(value)
		{
			locked = true;
			var i;
			for(i=1; i < 6; i++)
			{
				if(i <= value)
				{
					document.getElementById("star-" + i).src = "images/star.gif";
				}
				if(i > value)
				{
					document.getElementById("star-" + i).src = "images/star_gray.gif";
				}
			}	
			document.getElementById('Review1_ddlRating').value = value;
			updateRatingsText(value);
			return false;			
		}
		function updateRatingsText(value)
		{
			var text = ''
			switch(parseInt(value))
			{
				case(1):
					text = 'Poor';
					break;
				case(2):
					text = 'Below Average';
					break;
				case(3):
					text = 'Average';
					break;
				case(4):
					text = 'Good';
					break;
				case(5):
					text = 'Excellent';
					break;		
			}
			//document.getElementById('spnRatings').innerHTML = text;
			document.getElementById('spnRating').style.color = '#000000';
		}
		function Close()
		{
		    parent.HideDhtml();
		}
 	


function Rinit()
{
    document.getElementById('img').src = "../images/Items_ThumbNailSmall/" + document.getElementById('ctl00_ContentPlaceHolder1_hdnImageID').value;
    document.getElementById('spnS').innerHTML = document.getElementById('ctl00_ContentPlaceHolder1_hdnStyle').value;
    document.getElementById('spnN').innerHTML = document.getElementById('ctl00_ContentPlaceHolder1_lblItemName').innerHTML;
}

function SendReview()
{
	if(RValidate())
	{
		var s = escape(document.getElementById('ctl00_ContentPlaceHolder1_hdnStyle').value);
		var re = escape(document.getElementById('tbReview').value);
		var n = '';//escape(document.getElementById('tbName').value);
		var t = escape(document.getElementById('tbTitle').value);
		var r = escape(document.getElementById('Review1_ddlRating').value);
		var l = escape(location.href);
		var e = '';//escape(document.getElementById('tbEmail').value);
	
		(new Image).src="Misc/Recieve.aspx?func=review&s=" + s + "&re=" + re + "&n=" + n + "&t=" + t + "&r=" + r + "&l=" + l + "&e=" + e;
		document.getElementById('btnPostReview').value = "Thank You";
		document.getElementById('btnPostReview').disabled = true;
		setTimeout("ShowHideReview()", 2000);
	}
	
}
function RValidate()
{
	var isValid = true;
	if(document.getElementById('tbReview').value == '') { document.getElementById('spnReview').style.color = 'red'; isValid = false;}
	//if(document.getElementById('tbName').value == '')  { document.getElementById('spnName').style.color = 'red'; isValid = false;}
	if(document.getElementById('tbTitle').value == '')  { document.getElementById('spnTitle').style.color = 'red'; isValid = false;}
	if(document.getElementById('Review1_ddlRating').value == '0')  { document.getElementById('spnRating').style.color = 'red'; isValid = false;}
	return isValid;
}

function spnCreditQuestion_click()
{
    if (document.getElementById('dvCreditEmail').style.display == 'block')
    {
        document.getElementById('spnCreditQuestion').innerHTML = 'I would like to get discount towards my purchase';
        document.getElementById('dvCreditEmail').style.display = 'none';
        document.getElementById('tbEmail').value = '';
    }
    else
    {
        document.getElementById('spnCreditQuestion').innerHTML = 'No Thanks';
        document.getElementById('dvCreditEmail').style.display = 'block';
    }
}
