/******************************************
* Popup Box- By Jim Silver @ jimsilver47@yahoo.com
* Visit http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for use
******************************************/

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("CSC_reviewDIV") : document.all.CSC_reviewDIV
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////
function hidereviewpop(){
HideShowSelects("visible");
crossobj=ns6? document.getElementById("CSC_reviewDIV") : document.all.CSC_reviewDIV
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.CSC_reviewDIV.visibility="hide"
}

function HideShowSelects(action){
NumForms = document.forms.length;
for(X=0;X<NumForms;X++){
	iFRM = document.forms[X];
for(Y=0;Y<iFRM.elements.length;Y++){
	iType = iFRM.elements[Y].type;
	iName = iFRM.elements[Y].name;
	if(iType.indexOf("select")>-1 && iName.indexOf("rating") == -1){
		iFRM.elements[Y].style.visibility=action;
	}

}
}

}

function popreview(){
HideShowSelects("hidden");
crossobj=ns6? document.getElementById("CSC_reviewDIV") : document.all.CSC_reviewDIV
var X = (screen.width - 650) / 2;
var Y = (screen.height - 350) / 2;


if (ie4||ns6){
	crossobj.style.visibility="visible";
	crossobj.style.left=X;
	crossobj.style.top=Y;
}
else if (ns4){
	document.CSC_reviewDIV.visibility="show";
	document.CSC_reviewDIV.left=X;
	document.CSC_reviewDIV.top=Y;
}
}

function DrawForm(Product_ID,Path){

	Tag = "orm";
	Page = "csc_send_review_Email";
document.writeln('<f'+Tag+' action="/'+Page+'.cfm" method="post" name="CSC_reviewPOP">');
document.writeln('<table width="100%" cellpadding="2" cellspacing="0" border="0" class="border" bgcolor="#f8f8f8">');
document.writeln('<TR><TD colspan="2" align="center" class="header">Review This Product</TD></TR>');
document.writeln('<TR><TD colspan="2" width="100%" valign="top" align="right"><a href="javascript:hidereviewpop();" class="links">[Close Me]</a></TD></TR>');
document.writeln('<TR>');
document.writeln('	<TD width="25%" valign="top"><b>Rating</b></TD>');
document.writeln('	<TD width="75%" valign="top">');
document.writeln('<input checked type="radio" name="rating" value="5" id="rate_5"><img src="/images/star.gif"><img src="/images/star.gif"><img src="/images/star.gif"><img src="/images/star.gif"><img src="/images/star.gif">');
document.writeln('<input type="radio" name="rating" value="4" id="rate_4"><img src="/images/star.gif"><img src="/images/star.gif"><img src="/images/star.gif"><img src="/images/star.gif">');
document.writeln('<input type="radio" name="rating" value="3" id="rate_3"><img src="/images/star.gif"><img src="/images/star.gif"><img src="/images/star.gif">');
document.writeln('<input type="radio" name="rating" value="2" id="rate_2"><img src="/images/star.gif"><img src="/images/star.gif">');
document.writeln('<input type="radio" name="rating" value="1" id="rate_1"><img src="/images/star.gif">');
document.writeln('</TD>');
document.writeln('</TR>');
document.writeln('<TR>');
document.writeln('	<TD width="25%" valign="top"><b>Your Name</b></TD>');
document.writeln('	<TD width="75%" valign="top"><input type="text" name="name" size="35"></TD>');
document.writeln('</TR>');
document.writeln('<TR>');
document.writeln('	<TD width="25%" valign="top"><b>Your Email</b></TD>');
document.writeln('	<TD width="75%" valign="top"><input type="text" name="email" size="35"></TD>');
document.writeln('</TR>');
document.writeln('<TR>');
document.writeln('	<TD width="25%" valign="top"><b>Your Product Review</b></TD>');
document.writeln('	<TD width="75%" valign="top"><textarea cols="55" rows="10" name="review"></textarea></TD>');
document.writeln('</TR>');
document.writeln('<TR>');
document.writeln('	<TD width="100%" colspan="2" valign="top" align="center"><input type="button" onclick="vldreview();" value="Post Product Review"></TD>');
document.writeln('</TR>');
document.writeln('</table>');
document.writeln('<input type="hidden" name="product_id" value="'+Product_ID+'">');
document.writeln('<input type="hidden" name="gopage" value="'+Path+'">');
document.writeln('</f'+Tag+'>');
}