// Checks for valid email address
	function echeck(str) {
		 return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	}

// embeds a Flash movie
	function embedFlash(path, width, height, bgcolor) {
		if (! bgcolor) {
			bgcolor = "ffffff";
		}
		document.write("<OBJECT ");
			document.write("classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
			document.write("width=" + width + " height=" + height + ">");
			document.write("<param name=movie value='" + path + "'>");
			document.write("<param name=quality value=high>");
			document.write("<param name=menu value='false'>");
			document.write("<param name=wmode value='transparent'>");
		document.write("<embed src='" + path + "' quality=high bgcolor='" + bgcolor + "' width=" + width + " height=" + height + " ");
			document.write("type='application/x-shockwave-flash' ");
			document.write("menu='false' wmode='transparent'");
			document.write("PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'>");
		document.write("</embed>");
		document.write("</object>");
	}
	

// open a generic popup window, specifying source and size

	function popup(source,width,height) {
		popup_window = window.open(source,"popup_window","width="+String(width)+",height="+String(height)+",location=no,menubar=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes,status=yes");
		popup_window.focus()
	}


// write a random element from the specified array

	function writeRandom(arrayName) {
		which = (Math.round(Math.random() * (arrayName.length - 1)))
		document.write(arrayName[which])
	}


// the simplest possible rollover function

	function swap(name,state) {
		eval('document.images.' + name + '.src = ' + name + '_' + String(state) + '.src')
	}
	
// write a block of code that preloads a list of graphics
// - used at the top of any page that contains rollovers

	function makePreloads(names) {
		names = names.split(",")
		for (i=0; i < names.length; i++) {
			thisName = names[i]
			eval(thisName+"_0 = new Image()")
			eval(thisName+"_0.src = 'images/"+thisName+"_0.png'")
			eval(thisName+"_1 = new Image()")
			eval(thisName+"_1.src = 'images/"+thisName+"_1.png'")
		}
	}
	
	function makePCPreloads(names) {
		names = names.split(",")
		for (i=0; i < names.length; i++) {
			thisName = names[i]
			eval(thisName+"_0 = new Image()")
			eval(thisName+"_0.src = 'images/puppycam/"+thisName+"_0.png'")
			eval(thisName+"_1 = new Image()")
			eval(thisName+"_1.src = 'images/puppycam/"+thisName+"_1.png'")
		}
	}
	
	function makePreloadsJpg(names) {
		names = names.split(",")
		for (i=0; i < names.length; i++) {
			thisName = names[i]
			eval(thisName+"_0 = new Image()")
			eval(thisName+"_0.src = 'images/"+thisName+"_0.jpg'")
			eval(thisName+"_1 = new Image()")
			eval(thisName+"_1.src = 'images/"+thisName+"_1.jpg'")
		}
	}
	
	function selectedValue(selBox) {
  		return selBox.options[selBox.selectedIndex].value;
	}
	
	
	// Validates an email address
	
	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){
			   alert("Invalid E-mail ID")
			   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					
		}

	// Flag comments
	function flagMe(commentid, assetid)
	{
		var reason = prompt("Reason for flagging this comment:","");
		if (reason != '' && reason != null) {
			location = "comment_flag.php?commentID=" + commentid + "&assetID=" + assetid + "&reason=" + reason;
		}
	}


