//temp1a=new Image; temp1b=new Image;
//temp1a.src="images/next_on.gif"; 
//temp1b.src="images/prev_on.gif";


var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
if (IE6) {
	alert("For the best user experience, please upgrade your browser to at least Internet Explorer 7 or Firefox. Thank you.");
}

function CombineFields() {

f = document.searchform;

f.keyword.value = f.keyword2.value + " " + f.style.value;
return true;

}

function setKeyword(keyword) {

f = document.catform;

f.keyword.value = keyword;
f.submit();

}

function setKeyword2(keyword) {

f = document.catform2;

f.keyword.value = keyword;
f.submit();

}


/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var sname=document.cform.name
	var smessage=document.cform.message
	var emailID=document.cform.email
	
	if ((sname.value==null)||(sname.value=="")||(smessage.value==null)||(smessage.value=="")){
		alert("Please complete all required fields.")
		sname.focus()
		return false
	}	
	
	if ((emailID.value==null)||(emailID.value=="")||(echeck(emailID.value)==false)){
		alert("Please enter a valid email address.")
		emailID.focus()
		return false
	}
	return true
 }
 
 function ValidateCommentForm(num){
 	var f = eval("document.commentform_" + num);
	var name = eval("document.commentform_" + num + ".name");
	var message = eval("document.commentform_" + num + ".comment");
	var website = eval("document.commentform_" + num + ".website");
	var emailID = eval("document.commentform_" + num + ".email");
	
	if ((name.value=="") || (message.value=="")) {
		alert("Please enter your name, email and a comment.")
		name.focus()
	} else if ((emailID.value=="") || (echeck(emailID.value)==false)) {
		alert("Please enter a valid email address.")
		emailID.focus()
	} else {

		
		f.submit();
		var commenttext = document.getElementById('commentsbox_text_' + num).innerHTML;
		document.getElementById('commentsbox_text_' + num).innerHTML = '<p><font id="smalltext">' + mydate + '</font><br /><span id="comment_name">' + name.value + ':</span> ' + message.value + '</p>' + commenttext;
		name.value = "";
		emailID.value = "";
		website.value = "";
		message.value = "";		
	}
	
 }
 
 function saveVote(num, num2) {
 	
 	var numofvotes = eval("document.vform_" + num + "_" + num2 + ".numofvotes.value");
 	numofvotes = parseInt(numofvotes) + 1;
 	var s = "";
 	if (numofvotes > 1) {
	 	s = "s";
	 }
 	document.getElementById("votenum_" + num + "_" +  num2).innerHTML = numofvotes + " vote" + s + " <img src='images/spacer.gif' width='1' height='22' align='absmiddle'>";

 	eval("document.vimage_" + num + "_" + num2 + ".src = 'images/voted.gif'");
  	var f = eval("document.vform_" + num + "_" + num2);  	
  	f.submit();
 
 }
 
 function saveVote2(num) {
 	
 	var f = eval("document.form_" + num); 
 	var numofvotes = eval("f.votes_" + f.currentnum.value + ".value");
 	numofvotes = parseInt(numofvotes) + 1;
 	var s = "";
 	if (numofvotes > 1) {
	 	s = "s";
	 }
 	document.getElementById("numvotes_" + num).innerHTML = numofvotes + " vote" + s + " <img src='images/spacer.gif' width='1' height='22' align='absmiddle'>"; 	
 	
 	eval("document.vimage_" + num + ".src = 'images/voted.gif'");
  	f.submit();
 
 }
 
 function noVote() {
 
 	// do nothing
 
 }


