var jsReady = false;
/* do not change the name of this function */
function isReady() {
	return jsReady;
}
function pageInit() {
	jsReady = true;
}
function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}

/* do not change the name of this function */
function VideoViewCount(value) {
	setCookie("wc_vview", value);
	//if (value > maxView) { $("#show_overlay").val(1); }
}


function sendToActionScript(movieName, value) {
	thisMovie(movieName).sendToActionScript(value);
}

function canViewVids()
{
	var views = Math.ceil(getCookie("wc_vview"));
	var maxView = 4;
	if(views > maxView) return false; else return true;
}

function setCookie(name, value, path, expires, domain, secure) {
  var curCookie = name + "=" + escape(value) +
  ((expires) ? "; expires=" + expires.toGMTString() : "") +
  ((path) ? "; path=" + path : "; path=/") +
  ((domain) ? "; domain=" + domain : "") +
  ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var prefix = name + "=";
  var cookieStartIndex = document.cookie.indexOf(prefix);
  if(cookieStartIndex == -1) return null;
  var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
  if(cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
  return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function play_flv_video(file, image){
  
  var s1 = new SWFObject("http://webcams.com/flash/new_player/flvplayer.swf", "swf_player_embed", "482", "362", "7");
    s1.addParam("allowfullscreen", "true");
    s1.addVariable("file", file);
    s1.addVariable("image", image);
    if(!canViewVids()) 
	{
	  s1.addVariable("overlayn", "/flash/new_player/overlay_n_anon_webcams2009.png");
	  s1.addVariable("overlayf", "/flash/new_player/overlay_f_anon_webcams2009.png");
	}
    s1.addVariable("cpath", "/flash/new_player/config");
    s1.addVariable("vtype", "guest");
	s1.write("swf_player");
}


