// JavaScript Document
function checkCookie(c_value) {
if (document.cookie.length>0) {
  c_name = "VTBVIDEO="+c_value;
  c_start=document.cookie.indexOf(c_name)
  if(c_start==-1) {
  setCookie("VTBVIDEO",c_value,1);
  return false;
  }
  else 
  return true;
	
}
setCookie("VTBVIDEO",c_value,1);
return false
}

function setCookie(c_name,value,expiredays) {
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function textCounter(field, countfield, maxlimit) 
{
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
function popWindow(pgSource,winName,w,h)
{
  //window.open(pgSource, winName, 'toolbar=no,width='+w+',height='+h+',resizable=0,scrollbars');
  myWindow = window.open(pgSource, winName);
}
function send(num)
{
myform = document.getElementById("_xclick");
for(i=0;i<3;i++) {
  if(myform.elements['curr'+num][i]['checked'])
	var curr = myform.elements['curr'+num][i]['value'];
}
myform.elements['currency_code']['value'] = curr.substring(0,3);
myform.elements['amount']['value'] = curr.substring(3);
myform.elements['item_name']['value'] = myform.elements['item_name'+num]['value'];
myform.action ="https://www.paypal.com/cgi-bin/webscr"; 
}
function registerFormShow(artid) {
html="<div align='left'>";	
html+="<p class='hilight_s'>Please fill out this form to register:</span></p>";
html+="<form name='register' method='post' onsubmit='javascript: return validateReg(this)'>";
html+="<TABLE cellSpacing=2 cellPadding=0 border=0>";
html+="<TR><TD>E-mail<span class='style1'>*</span>:</TD>";
html+="<TD><INPUT maxLength=60 size=40 name=email></TD></TR>";
html+="<TR><TD>Password<span class='style1'>*</span>:</TD>";
html+="<TD><INPUT type=password maxLength=60 size=40 name=pass1></TD></TR>";
html+="<TR><TD>Confirm Password<span class='style1'>*</span>:</TD>";
html+="<TD><INPUT type=password  maxLength=60 size=40 name=pass2></TD></TR>";
html+="<TR><TD>Name:</TD>";
html+="<TD><INPUT maxLength=60 size=40 name=name></TD></TR>";
html+="<TR><TD>Company:</TD>";
html+="<TD><INPUT maxLength=60 size=40 name=company></TD></TR>";
html+="<TR><TD>Phone:</TD>";
html+="<TD><INPUT maxLength=60 size=40 name=phone></TD></TR></TABLE>";
html+="<input type=hidden value="+artid+" name='sub' />";
html+="<BR><BR><INPUT type=submit value=Register> <INPUT type=reset value='Reset'></FORM></div>";
d=document.getElementById("login_register");
d.innerHTML=html;
}
//
function validateLogin(myform) {
if(!validate_email(myform["email"])) {
 alert("Invalid Email!")
 myform.email.focus();
 return false;
 }
if(myform["password"].value=="") {
  alert("Please Enter the Password!")
   myform.password.focus();
 	return false;
	}
 myform.action = "login.php";
}
function validate_email(field)
{
apos=field.value.indexOf("@")
dotpos=field.value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {return false}
else {return true}
}
function validateReg(myform) {
if(!validate_email(myform["email"])) {
 alert("Invalid Email!")
 myform.email.focus();
 return false;
 }
if(myform["pass1"].value=="") {
  alert("Please Enter the Password!")
   myform.pass1.focus();
 	return false;
	}
if(myform["pass2"].value=="") {
  alert("Please Confirm the Password!")
   myform.pass1.focus();
 	return false;
	}
if(myform["pass1"].value!=myform["pass2"].value) {
  alert("Password doesn't match!")
   myform.pass1.focus();
 	return false;
	}
 myform.action = "register.php";
}