
function getFlashVersion(){
	var b = navigator.userAgent.toLowerCase();
	if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
		document.writeln('<script language="VBscript">');
		document.writeln('Function detectActiveXControl(activeXControlName)');
		document.writeln('  on error resume next');
		document.writeln('  detectActiveXControl = False');
		document.writeln('  detectActiveXControl = IsObject(CreateObject(activeXControlName))');
		document.writeln('End Function');
		document.writeln('</scr' + 'ipt>');
	}
	var installedVersion = 0;
	if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
		for (var i=3; i<10; i++){
			if(detectActiveXControl("ShockwaveFlash.ShockwaveFlash."+i) == true) installedVersion = i;
		}
	} else {
		if (navigator.plugins["Shockwave Flash"]) {
			var pluginDesc = navigator.plugins["Shockwave Flash"].description;
			installedVersion = parseInt( pluginDesc.charAt( pluginDesc.indexOf(".")-1 ) );
		}
		if(b.indexOf("webtv") != -1) installedVersion = 3;  
	}
	return installedVersion;
}

function wmShowVideo(show_id, width, height){
	document.write('<OBJECT ID="MediaPlayer1" width='+width+' height='+height+' classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">');
	document.write('<param name="FileName" value="http://www.camz.com/app-bin/stream.php?id='+show_id+'">');
	document.write('<param name="ShowControls" value="0">');
	document.write('<param name="ShowDisplay" value="0">');
	document.write('<param name="ShowStatusBar" value="1">');
	document.write('<param name="AutoSize" value="0">');
	document.write('<param name="AnimationAtStart" value="0">');
	document.write('<param name="TransparentAtStart" value="1">');
	document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" filename="http://www.camz.com/app-bin/stream.php?id='+show_id+'" src="http://www.camz.com/app-bin/stream.php?id='+show_id+'" name="MediaPlayer1" showcontrols=0 showdisplay=0 showstatusbar=0 width='+width+' height='+height+'></embed>');
	document.write('</OBJECT>\n');
}

function wmShowVideoNA(show_id, width, height){
	document.write('<OBJECT ID="MediaPlayer1" width='+width+' height='+height+' classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">');
	document.write('<param name="FileName" value="http://www.camz.com/app-bin/stream.php?id='+show_id+'&na=true">');
	document.write('<param name="ShowControls" value="0">');
	document.write('<param name="ShowDisplay" value="0">');
	document.write('<param name="ShowStatusBar" value="1">');
	document.write('<param name="AutoSize" value="0">');
	document.write('<param name="AnimationAtStart" value="0">');
	document.write('<param name="TransparentAtStart" value="1">');
	document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" filename="http://www.camz.com/app-bin/stream.php?id='+show_id+'&na=true" src="http://www.camz.com/app-bin/stream.php?id='+show_id+'&na=true" name="MediaPlayer1" showcontrols=0 showdisplay=0 showstatusbar=0 width='+width+' height='+height+'></embed>');
	document.write('</OBJECT>\n');
}

function wmShowAudioOnly(show_id, width, height){
	document.write('<OBJECT ID="MediaPlayer1" width='+width+' height='+height+' classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject" style=" position:absolute; visibility:hidden; top:0; left:0; z-index: -1;">');
	document.write('<param name="FileName" value="http://www.camz.com/app-bin/stream.php?id='+show_id+'">');
	document.write('<param name="ShowControls" value="0">');
	document.write('<param name="ShowDisplay" value="0">');
	document.write('<param name="ShowStatusBar" value="1">');
	document.write('<param name="AutoSize" value="0">');
	document.write('<param name="AnimationAtStart" value="0">');
	document.write('<param name="TransparentAtStart" value="1">');
	document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" filename="http://www.camz.com/app-bin/stream.php?id='+show_id+'" src="http://www.camz.com/app-bin/stream.php?id='+show_id+'" name="MediaPlayer1" showcontrols=0 showdisplay=0 showstatusbar=0 width='+width+' height='+height+'></embed>');
	document.write('</OBJECT>\n');
}

function wmTestVideo(stream_url, width, height){
	document.write('<OBJECT ID="MediaPlayer1" width='+width+' height='+height+' classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">');
	document.write('<param name="FileName" value="'+stream_url+'">');
	document.write('<param name="ShowControls" value="0">');
	document.write('<param name="ShowDisplay" value="0">');
	document.write('<param name="ShowStatusBar" value="1">');
	document.write('<param name="AutoSize" value="0">');
	document.write('<param name="AnimationAtStart" value="0">');
	document.write('<param name="TransparentAtStart" value="1">');
	document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" filename="'+stream_url+'" src="'+stream_url+'" name="MediaPlayer1" showcontrols=0 showdisplay=0 showstatusbar=0 width='+width+' height='+height+'></embed>');
	document.write('</OBJECT>\n');
}

function flashShowVideo(performer_name, width, height, bgcolor){
	if(bgcolor == undefined) bgcolor = '000000';
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'" id="camz_user_500" ALIGN="middle">');
	document.write('<param name="FlashVars" value="performer='+performer_name+'" />');	
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="true" />');
	document.write('<param name="movie" value="http://files.camz.com/flash_clients/camz_user_500.swf?performer='+performer_name+'" />');
	document.write('<param name="loop" value="false" />');
	document.write('<param name="menu" value="true" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value='+bgcolor+'>');
	document.write('<embed src="http://files.camz.com/flash_clients/camz_user_500.swf?performer='+performer_name+'" loop="false" menu="true"	quality="high" bgcolor='+bgcolor+' width="'+width+'" height="'+height+'" name="camz_user_500" FlashVars="performer='+performer_name+'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');		
	document.write('</OBJECT>');
}

function flashClipViewer(pid,bgcolor){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" WIDTH="590" HEIGHT="300" id="bestof_Viewer" ALIGN="middle">');
	document.write('<param name="FlashVars" value="pid='+pid+'&bgc=0x'+bgcolor+'" />');	
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="http://files.camz.com/flash_clients/bestof_viewer_new.swf?pid='+pid+'&bgc=0x'+bgcolor+'" />');
	document.write('<param name="loop" value="false" />');
	document.write('<param name="menu" value="true" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value=#'+bgcolor+'>');
	document.write('<param name="wmode" value="transparent">');
	document.write('<embed src="http://files.camz.com/flash_clients/bestof_viewer_new.swf?pid='+pid+'&bgc=0x'+bgcolor+'" wmode="transparent" loop="false" menu="true" quality="high" width="590" height="300" name="bestof_viewer" FlashVars="pid='+pid+'&bgc=0x'+bgcolor+'" align="middle" bgcolor="#'+bgcolor+'" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');		
	document.write('</OBJECT>');
}

function flashMemberShowVideo(performer_name, width, height,bgcolor,tracker_link){
	performer_name = performer_name.replace("-members", "");
	document.write('<table><tr><td align="center">');
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="livestream_ac" align="middle">');
	document.write('<param name="FlashVars" value="performer='+performer_name+'" />');	
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="allowFullScreen" value="true" />');
	document.write('<param name="movie" value="http://files.privatecamz.com/livestream/livestream_ac.swf?appname=members&show_id='+performer_name+'" />');
	document.write('<param name="menu" value="true" />');
	document.write('<param name="quality" value="high" />');
	document.write('<embed src="http://files.privatecamz.com/livestream/livestream_ac.swf?appname=members&show_id='+performer_name+'" menu="false" quality="high" width="'+width+'" height="'+height+'" name="livestream_ac" FlashVars="appname=members&show_id='+performer_name+'" align="middle" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
	document.write('<br><b><a href="'+tracker_link+'">Click Here For More Live Performers</a></b>');
	document.write('</td></tr></table>');
}

function flashxPeepsShowVideo(performer_name, width, height, bgcolor){
	document.write('<table><tr><td align="center">');
	if(bgcolor == undefined) bgcolor = '000000';
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'" id="camz_user_500" ALIGN="middle">');
	document.write('<param name="FlashVars" value="performer='+performer_name+'" />');	
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="true" />');
	document.write('<param name="movie" value="http://files.camz.com/flash_clients/camz_user_xpeeps.swf?performer='+performer_name+'" />');
	document.write('<param name="loop" value="false" />');
	document.write('<param name="menu" value="true" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value='+bgcolor+'>');
	document.write('<embed src="http://files.camz.com/flash_clients/camz_user_xpeeps.swf?performer='+performer_name+'" loop="false" menu="true"	quality="high" bgcolor='+bgcolor+' width="'+width+'" height="'+height+'" name="camz_user_xpeeps" FlashVars="performer='+performer_name+'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');		
	document.write('</OBJECT>');
	document.write('<br><b><a href="'+tracker_link+'">Click Here For More Live Performers</a></b>');
	document.write('</td></tr></table>');
}

// set in the page
var access_id = null;

function flashChat(room, width, height,bgcolor){
	hide_viewer_count = false;
	if(room == "ksex") hide_viewer_count = true;
	var access_param = '';
	if(access_id != null){ 
		access_param = '&access_id='+access_id;
	}

	bgcolor= "#ffffff";
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"  WIDTH="'+width+'" HEIGHT="'+height+'" id="ciChatBase" ALIGN="">');
	document.write('<PARAM NAME=movie VALUE="http://files.camz.com/flash_clients/ciChatBase.swf?host=66.78.2.10&room='+room+'&autojoin=true&hide_viewer_count='+hide_viewer_count+access_param+'">');
	document.write('<PARAM NAME=loop VALUE=false>');
	document.write('<PARAM NAME=menu VALUE=false>');
	document.write('<PARAM NAME=quality VALUE=high>');
	document.write('<PARAM NAME=bgcolor VALUE='+bgcolor+'>');
	document.write('<PARAM NAME="host" VALUE="66.78.2.10">');
	document.write('<PARAM NAME="room" VALUE="'+room+'">');
	if(access_id != null){ 
		document.write('<PARAM NAME="access_id" VALUE="'+access_id+'">'); 
	}
	document.write('<PARAM NAME="hide_viewer_count" VALUE="'+hide_viewer_count+'">');
	document.write('<PARAM NAME=autojoin VALUE=true>');
	document.write('<EMBED src="http://files.camz.com/flash_clients/ciChatBase.swf?host=66.78.2.10&room='+room+'&autojoin=true&hide_viewer_count='+hide_viewer_count+access_param+'" loop=false menu=false quality=low bgcolor='+bgcolor+'  WIDTH="'+width+'" HEIGHT="'+height+'" NAME="ciChatBase" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" FlashVars=" room='+room+'"></EMBED>');
	document.write('</OBJECT>');	
}

function flashMemberChat(room, width, height, bgcolor, tracker_link){
	room = room.replace("-members", "");
	room += "-members";
	document.write('<table><tr><td align="center">');
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'" id="livestream_chat" align="">');
	document.write('<param name="movie" value="http://files.privatecamz.com/livestream/livestream_chat.swf?performer='+room+'" />');
	document.write('<param name="menu" VALUE=false" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="performer" value="'+room+'" />');
	document.write('<embed src="http://files.privatecamz.com/livestream/livestream_chat.swf?performer='+room+'" menu="false" quality="high" width="'+width+'" height="'+height+'" name="livestream_chat" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="performer='+room+'"></embed>');
	document.write('</object>');
	document.write('<br><b><a href="'+tracker_link+'">Click Here For More Live Performers</a></b>');
	document.write('</td></tr></table>');
}

function flashChatOp(room, width, height, bgcolor, auth_key, power){
		var bgcolor= "#ffffff";
		var hide_viewer_count = false;
		if(room.toLowerCase() == "ksex") hide_viewer_count = true;
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"  WIDTH="'+width+'" HEIGHT="'+height+'" id="ciChatBase" ALIGN="">');
		document.write('<PARAM NAME=movie VALUE="http://files.camz.com/flash_clients/ciChatBase.swf?host=66.78.2.10&room='+room+'&operator=true&password='+auth_key+'&power='+power+'&hide_viewer_count='+hide_viewer_count+'">');
		document.write('<PARAM NAME=loop VALUE=false>');
		document.write('<PARAM NAME=menu VALUE=false>');
		document.write('<PARAM NAME=quality VALUE=high>');
		document.write('<PARAM NAME=bgcolor VALUE='+bgcolor+'>');
		document.write('<PARAM NAME="host" VALUE="66.78.2.10">');
		document.write('<PARAM NAME="room" VALUE="'+room+'">');
		document.write('<PARAM NAME="operator" VALUE=true>');
		document.write('<PARAM NAME="password" VALUE="'+auth_key+'">');
		document.write('<PARAM NAME="power" VALUE="'+power+'">');
		document.write('<PARAM NAME="hide_viewer_count" VALUE="'+hide_viewer_count+'">');
		document.write('<EMBED src="http://files.camz.com/flash_clients/ciChatBase.swf?host=66.78.2.10&room='+room+'&operator=true&password='+auth_key+'&power='+power+'&hide_viewer_count='+hide_viewer_count+'" loop=false menu=false quality=low bgcolor='+bgcolor+'  WIDTH="'+width+'" HEIGHT="'+height+'" NAME="ciChatBase" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" FlashVars=" room='+room+'"></EMBED>');
		document.write('</OBJECT>');
}

function viewerCounter(access_id, show_id){
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"  WIDTH="1" HEIGHT="1" id="camz_view_counter_300" ALIGN="">');
		document.write('<PARAM NAME=movie VALUE="http://files.camz.com/flash_clients/camz_view_counter_300.swf?access_id='+access_id+'&show_id='+show_id+'">');
		document.write('<PARAM NAME=loop VALUE=false>');
		document.write('<PARAM NAME=menu VALUE=true>');
		document.write('<PARAM NAME=quality VALUE=high>');
		document.write('<PARAM NAME="access_id" VALUE="'+access_id+'">');
		document.write('<PARAM NAME="show_id" VALUE="'+show_id+'">');
		document.write('<EMBED src="http://files.camz.com/flash_clients/camz_view_counter_300.swf?access_id='+access_id+'&show_id='+show_id+'" loop=false menu=true quality=low  WIDTH="1" HEIGHT="1" NAME="camz_view_counter_300" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');
		document.write('</OBJECT>');
}

function doVote(form){	
	for(var i=0; i < form.rating.length; i++)	{
		if(form.rating[i].checked){
		window.open(form.rating_url.value+'?rating='+form.rating[i].value+'&show_id='+form.show_id.value+'&key='+form.key.value+'&access_id='+form.access_id.value, "result", "width=225,height=25,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
		}
	}
}
