// JavaScript Document
//common tech2 js functions
function textLimit(field, maxlen) {
	if (field.value.length > maxlen) {
	field.value = field.value.substring(0, maxlen);
	alert('Only 800 Character Allowed!');
	} 
}

function validate(){
	emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/
	val = document.comments;
	if(val.commentname.value == '' || val.commentname.value=='Name'){
		alert("Enter your name");
		val.commentname.focus();
		return false;
	}
	if(val.address.value == '' || val.address.value=='City'){
		alert("Enter your city");
		val.address.focus();
		return false;
	}
	if (!emailRe.test(val.email.value)) {
		alert("Enter Valid Email");
		val.email.focus();
		return false;
	}
	if(val.comment.value == ''){
		alert("Hello! No comment ?");
		val.comment.focus();
		return false;
	}
	val.submit();
	//return true;
}
function writit(text,id){
for(i=1;i<=10;i++){
	tagid="rImage"+i;
	if(i % 2 == 1){
		document.getElementById(tagid).src="/images/rstar1off.jpg";
	}
	else{
		document.getElementById(tagid).src="/images/rstar2off.jpg";
	}
}
cnt=text*2;
for(i=1;i<=cnt;i++){
	tagid="rImage"+i;
	modi = i%2;
	if(modi == 0){
		document.getElementById(tagid).src="/images/rstar2on.jpg";
	}
	else{
		document.getElementById(tagid).src="/images/rstar1on.jpg";
	}
}
	disptext = text + " Star";
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = disptext;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = disptext;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = '<P CLASS="ntdBL">' + disptext + '</P>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}

function clearrating(){
	for(i=1;i<=10;i++){
		tagid="rImage"+i;
		if(i % 2 == 1){
			document.getElementById(tagid).src="/images/rstar1off.jpg";
		}
		else{
			document.getElementById(tagid).src="/images/rstar2off.jpg";
		}
	}
	disptext = "";
	id="test"
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = disptext;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = disptext;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = '<P CLASS="ntdBL">' + disptext + '</P>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}

function drawrating(x,y){
	prnt = "<ul>";
	for(i=1;i<=x;i++){
		prnt += "<li style=\"margin-left:5px;\"><img src=\"/images/video_star.jpg\" width=28 height=24 hspace=0 vspace=0 border=0></li>";
	}
	if(y > 0){
		prnt += "<li style=\"margin-left:5px;\"><img src=\"/images/video_halfstar.jpg\" width=28 height=24 hspace=0 vspace=0 border=0></li>";
	}
	else{
		y = 0;
	}
	prnt +=	"<li style=\"margin-left:25px;margin-top:5px;\" class=ntdBL>" + x + "." + y +" Stars</li>";
	document.getElementById("DynUsrRating").innerHTML = prnt;
	prnt += "</ul>";
}