// JOE'S AMAZING PARAMS KEWPIE
function params(qp){ try{r=unescape(location.search.match(new RegExp(qp+"=+([^&]*)"))[1]);}catch(e){r='';} return r; }

// COOKIES
var exp=new Date(); // get date
var oneYear=exp.getTime()+(365*24*60*60*1000); // set cookie expiration for 1 year from now
exp.setTime(oneYear);
cookieLife=exp.toGMTString(); // set to GMT time
var cookieData=document.cookie;
// SET THE COOKIE
function setCookie(name,value,expires,path,domain,secure){
	document.cookie=name+"="+escape(value)+((expires)?";expires="+expires:"")+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"");
}

// HOMEPAGE WEBCAM THUMBNAIL
function webcamThumb(){
	var timer=new Date();
	var seconds=timer.getSeconds();
	document.getElementById('webcamThumb').src="http://www.dohnetwork.com/webcam/spiffcamSml.jpg?"+seconds
	setTimeout('webcamThumb()',1000);
}

// SHOW FLASH MOVIE
function show(where,what){
	document.getElementById(where).innerHTML='<div style="position:relative;"><div style="position:absolute;top:0;left:0;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="394" height="296" id="flvPlayer" align="middle">\
	<param name="allowScriptAccess" value="sameDomain" />\
	<param name="movie" value="http://www.dohnetwork.com/'+what+'" />\
	<param name="quality" value="high" />\
	<param name="wmode" value="transparent" />\
	<param name="bgcolor" value="#ffffff" />\
	<embed src="http://www.dohnetwork.com/'+what+'" quality="high" bgcolor="#ffffff" width="394" height="296" name="flvPlayer" wmode="transparent" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\
	</object></div><div style="position:absolute;top:0;left:0;"><a href="javascript:close(\''+where+'\')"><img src="../spacer.gif" alt="" width="394" height="296" /></a></div></div>';
}
// HIDE FLASH MOVIE
function close(where){
	document.getElementById(where).innerHTML='';
}

// HIDDEN TEXT POPUPS
function launch(whattheheck){
	if(document.getElementById(whattheheck).style.display=="block"){
		document.getElementById(whattheheck).style.display="none";
	}else{
		document.getElementById(whattheheck).style.display="block";
	}
	if(whattheheck=="phone"){
		document.getElementById('feelings').style.display="none";
		document.getElementById('feelingsSorry').style.display="none";
	}
}


// AGE CHECK courtesy of http://www.kuranes.co.uk/utils/agecheck.html
function checkAge(){
	var min_age=18; // the minumum age you want to allow in
	// change "age_form" to whatever your form has for a name="..." 
	var year=parseInt(document.forms["age_form"]["year"].value);
	var month=parseInt(document.forms["age_form"]["month"].value)-1;
	var day=parseInt(document.forms["age_form"]["day"].value);
	var theirDate=new Date((year + min_age), month, day);
	var today=new Date;
	alert(today.getTime());
	alert(theirDate.getTime());
	if((today.getTime()-theirDate.getTime())<0){
		doTheRightThing('under');
		return false;
	}else{
		doTheRightThing('over');
		return false;
	}
}

// FLASH MOVIE TRAILER OVERLAY
function flash(trailerID){
	if(!location.host.match(/movies.dohnetwork.com/i)){window.location.replace('http://movies.dohnetwork.com/?'+trailerID);}else{
		if(trailerID=="close"){
			document.getElementById('flashOverlay').style.width="0%";
			document.getElementById('flashOverlay').style.height="0%";
			document.getElementById('flashTrailerContainer').style.display="none";
			document.getElementById('flashOverlay').style.display="none";
			document.getElementById('flashPlayer').innerHTML='';
		}else{
			document.getElementById('flashOverlay').style.width="100%";
			document.getElementById('flashOverlay').style.height="200%";
			document.getElementById('flashTrailerContainer').style.display="block";
			document.getElementById('flashOverlay').style.display="block";
			document.getElementById('flashPlayer').innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="464" height="376" id="myMovieName"><param name="movie" value="http://embed.break.com/'+trailerID+'"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFF"><embed src="http://embed.break.com/'+trailerID+'" width="464" height="376" autostart="false" quality="high" bgcolor="#FFFFFF" name="myMovieName" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';
		}
	}
}