// i----------------------------------------------------------
// Univeral method for javascript->flash setvariable
// -----------------------------------------------------------

/* -----------------------------------------------------------
----------Supporting Browsers----------
PC:
IE 5 and higher
Netscape 6 and higher
Moz/Firebird all
Opera 7 and higher

Mac OSX:
IE 5.2
Safari all
Netscape 6 and higher
Moz/Firebird/Camino all
Opera 6 and higher

Linux:
Konqueror assumed
----------------------------------------------------------- */
var ua        = navigator.userAgent.toLowerCase(); 
var is_pc_ie  = ( (ua.indexOf('msie') != -1 ) && ( ua.indexOf('win') != -1 ) && ( ua.indexOf('opera') == -1 ) && ( ua.indexOf('webtv') == -1 ) );



/* -----------------------------------------------------------
function setFlashVariables(movieid, flashquery)

movieid: id of object tag, name of movieid passed in through FlashVars
flashquery: querystring of values to set. example( var1=foo&var2=bar )
----------------------------------------------------------- */
function setFlashVariables(movieid, flashquery){
	
	var i,values;
	if(is_pc_ie){
		var chunk = flashquery.split("&");
		for(i in chunk){
			values = chunk[i].split("=");
			document[movieid].SetVariable(values[0],values[1]);
		}
	}else{
		var divcontainer = "flash_setvariables_"+movieid;
		if(!document.getElementById(divcontainer)){
			var divholder = document.createElement("div");
			divholder.id = divcontainer;
			document.body.appendChild(divholder);
		}
		document.getElementById(divcontainer).innerHTML = "";
		var divinfo = "<embed src='/exshot/flash/videoLibrary/gateway.swf' FlashVars='lc="+movieid+"&fq="+escape(flashquery)+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";
		document.getElementById(divcontainer).innerHTML = divinfo;
	}
}

function writeFreePreview (w, h, FlashVars) {
 	document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id="video_chat" align="">');
// 	document.writeln('<param name="allowScriptAccess" value="sameDomain" />')
 	document.writeln('<PARAM name="movie" value="/flash/chat/freePreview20.swf">');
 	document.writeln('<param name=FlashVars value="'+FlashVars+'" />');
 	document.writeln('<PARAM name="salign" value="LT">');
 	document.writeln('<PARAM name="quality" value="high">');
 	document.writeln('<PARAM name="bgcolor" value="#006666">');
 	document.writeln('<PARAM NAME=wmode VALUE=transparent>');
 	document.writeln('<embed src="/flash/chat/freePreview20.swf" salign="LT" FlashVars="' + FlashVars + '" quality="high" bgcolor="#006666" width='+w+' height='+h+' name="video_chat" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />');
 	document.writeln('</OBJECT>'); 
	document.title='熟女専門 感熟ライブ ホーム';
}

function createFreePreview (w, h, FlashVars) {
	document.title='熟女専門 感熟ライブ ホーム';
 	htmlstr	=	'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id="video_chat" align="">';
// 	htmlstr	=	htmlstr + '<param name="allowScriptAccess" value="sameDomain" />';
 	htmlstr	=	htmlstr + '<PARAM name="movie" value="/flash/chat/freePreview20.swf">';
 	htmlstr	=	htmlstr + '<param name=FlashVars value="'+FlashVars+'" />';
 	htmlstr	=	htmlstr + '<PARAM name="salign" value="LT">';
 	htmlstr	=	htmlstr + '<PARAM name="quality" value="high">';
 	htmlstr	=	htmlstr + '<PARAM name="bgcolor" value="#006666">';
 	htmlstr	=	htmlstr + '<PARAM NAME=wmode VALUE=transparent>';
 	htmlstr	=	htmlstr + '<embed src="/flash/chat/freePreview20.swf" salign="LT" FlashVars="' + FlashVars + '" quality="high" bgcolor="#006666" width='+w+' height='+h+' name="video_chat" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />';
 	htmlstr	=	htmlstr + '</OBJECT>'; 
 	return htmlstr;
}

function writeFreeLimitedPreview (w, h, FlashVars) {
        var joinLink = "https://www5.dtiserv3.com/cgi-bin/d2pjoin.fcgi?goods_id=20002917";
        var timeLimit = "30000";
        if (isFreeUser()){
            joinLink = "http://www.kanjukulive.com/join.html";
        }else{
            joinLink = "https://www5.dtiserv3.com/cgi-bin/d2pjoin.fcgi?goods_id=20002917";
        }
	var FlashVars = FlashVars + '&timeLimit='+timeLimit+'&timeOutLink='+joinLink;
 	document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id="video_chat" align="">');
// 	document.writeln('<param name="allowScriptAccess" value="sameDomain" />')
 	document.writeln('<PARAM name="movie" value="/flash/chat/limitedFreePreview20.swf">');
 	document.writeln('<param name=FlashVars value="'+FlashVars+'" />');
 	document.writeln('<PARAM name="salign" value="LT">');
 	document.writeln('<PARAM name="quality" value="high">');
 	document.writeln('<PARAM name="bgcolor" value="#006666">');
 	document.writeln('<PARAM NAME=wmode VALUE=transparent>');
 	document.writeln('<embed src="/flash/chat/limitedFreePreview20.swf" salign="LT" FlashVars="' + FlashVars + '" quality="high" bgcolor="#006666" width='+w+' height='+h+' name="video_chat" timeLimit='+timeLimit+' timeOutLink="'+joinLink+'" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />');
 	document.writeln('</OBJECT>'); 
	document.title='熟女専門 感熟ライブ ホーム'; 
}

function createFreeLimitedPreview (w, h, FlashVars) {
	document.title='熟女専門 感熟ライブ ホーム';
        var joinLink = "https://www5.dtiserv3.com/cgi-bin/d2pjoin.fcgi?goods_id=20002917";
        var timeLimit = "30000";
        if (isFreeUser()){
            joinLink = "http://www.kanjukulive.com/join.html";
        }else{
            joinLink = "https://www5.dtiserv3.com/cgi-bin/d2pjoin.fcgi?goods_id=20002917";
        }
	var FlashVars = FlashVars + '&timeLimit='+timeLimit+'&timeOutLink='+joinLink;
 	htmlstr	=	'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id="video_chat" align="">';
// 	htmlstr	=	htmlstr + '<param name="allowScriptAccess" value="sameDomain" />';
 	htmlstr	=	htmlstr + '<PARAM name="movie" value="/flash/chat/limitedFreePreview20.swf">';
 	htmlstr	=	htmlstr + '<param name=FlashVars value="'+FlashVars+'" />';
 	htmlstr	=	htmlstr + '<PARAM name="salign" value="LT">';
 	htmlstr	=	htmlstr + '<PARAM name="quality" value="high">';
 	htmlstr	=	htmlstr + '<PARAM name="bgcolor" value="#006666">';
 	htmlstr	=	htmlstr + '<PARAM NAME=wmode VALUE=transparent>';
 	htmlstr	=	htmlstr + '<embed src="/flash/chat/limitedFreePreview20.swf" salign="LT" FlashVars="' + FlashVars + '" quality="high" bgcolor="#006666" width='+w+' height='+h+' name="video_chat" timeLimit='+timeLimit+' timeOutLink="'+joinLink+'" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />';
 	htmlstr	=	htmlstr + '</OBJECT>';
 	return htmlstr;
}
 
function writeViewerChat(w,h,Fid,swfFile,FlashVars,quality,bgcolor,wmode){
  var wmodeTmp = '';
 	document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id='+Fid+' align="">');
 	//document.writeln('<param name="allowScriptAccess" value="sameDomain" />')
 	document.writeln('<PARAM name="movie" value='+swfFile+'>');
 	document.writeln('<param name=FlashVars value='+FlashVars+' />');
 	document.writeln('<PARAM name="salign" value="LT">');
 	document.writeln('<PARAM name="quality" value='+quality+'>');
 	document.writeln('<PARAM name="bgcolor" value='+bgcolor+'>');
 	document.writeln('<param name="allowFullScreen" value="true" />');
 	if(wmode != null && wmode != '') {
 		document.writeln('<param name="wmode" value='+ wmode +'/>');
    wmodeTmp = 'wmode= '+ wmode;
  }
 	document.writeln('<embed src='+swfFile+' salign="LT" FlashVars='+FlashVars+' quality='+quality+' bgcolor='+bgcolor+' '+wmodeTmp+' width='+w+' height='+h+' name='+Fid+' allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
 	document.writeln('</OBJECT>');
}

function writeVideoLibrary(w,h,swfFile,FlashVars,quality,bgcolor,id) {
 	document.writeln('<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='+w+' height='+h+' id="'+id+'" align="middle" STYLE="Z-INDEX:-1">');
// 	document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
	document.writeln('<param name="wmode"value="transparent" />');
 	document.writeln('<param name="movie" value='+swfFile+' />');
 	document.writeln('<param name=FlashVars value='+FlashVars+' />');
 	document.writeln('<param name="quality" value='+quality+' />');
 	document.writeln('<param name="bgcolor" value='+bgcolor+' />');
 	document.writeln('<param name="salign" value="LT" />');
        document.writeln('<param name="name" value="'+id+'" />');
        document.writeln('<PARAM NAME=wmode VALUE=transparent>');
 	document.writeln('<embed src='+swfFile+' flashvars='+FlashVars+' quality= '+quality+' wmode="transparent" bgcolor='+bgcolor+' width='+w+' height= '+h+' align="middle" salign="LT" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="'+id+'" name="'+id+'"/>');                
	document.writeln('</object>');
	document.title='熟女専門 感熟ライブ ホーム';
}

// ***************************************************************************

function createVideoLibrary(w,h,swfFile,FlashVars,quality,bgcolor,id) {
	vlhtml	=	'<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='+w+' height='+h+' id="'+id+'" align="middle" STYLE="Z-INDEX:-1">';
	vlhtml	=	'<param name="wmode"value="transparent" />';
	vlhtml	=	'<param name="movie" value='+swfFile+' />';
	vlhtml	=	'<param name=FlashVars value='+FlashVars+' />';
	vlhtml	=	'<param name="quality" value='+quality+' />';
	vlhtml	=	'<param name="bgcolor" value='+bgcolor+' />';
	vlhtml	=	'<param name="salign" value="LT" />';
	vlhtml	=	'<param name="name" value="'+id+'" />';
	vlhtml	=	'<PARAM NAME=wmode VALUE=transparent>';
	vlhtml	=	'<embed src='+swfFile+' flashvars='+FlashVars+' quality= '+quality+' wmode="transparent" bgcolor='+bgcolor+' width='+w+' height= '+h+' align="middle" salign="LT" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="'+id+'" name="'+id+'"/>';
	vlhtml	=	'</object>';
}

//****************************************************************************

function writeVideoRecorder(w,h,swfFile,FlashVars,quality,bgcolor){
 	document.writeln('<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='+w+' height='+h+' id="flashRecorder" align="middle">');
 	document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
 	document.writeln('<param name="movie" value='+swfFile+' />');
 	document.writeln('<param name=FlashVars value='+FlashVars+' />');
 	document.writeln('<param name="quality" value='+quality+' />');
 	document.writeln('<param name="bgcolor" value="#FFFFFF" />');
 	document.writeln('<param name="salign" value="LT" />');
 	document.writeln('<embed src='+swfFile+' flashvars='+FlashVars+' quality= '+quality+' bgcolor='+bgcolor+' width='+w+' height= '+h+' name="flashRecorder" align="middle" salign="LT" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');                
	document.writeln('</object>');
}
 
function writeFlashFile(w,h,swfFile,quality,bgcolor) {
 	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width='+w+' height='+h+' align="middle">');
 	document.writeln('<param name="movie" value='+swfFile+' />');
 	document.writeln('<param name="quality" value='+quality+' />');
 	document.writeln('<param name="bgcolor" value='+bgcolor+' />'); 
        document.writeln('<PARAM NAME=wmode VALUE=transparent>');
 	document.writeln('<embed src='+swfFile+' quality= '+quality+' bgcolor='+bgcolor+' width='+w+' height= '+h+' align="middle" wmode="transparent"  allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');                
	document.writeln('</object>');
}

var HDPublisherWindow;

function openHDPublisher()
{
    var HDPublisherDiv;
    var HDPublisherIframe;

    if( null !== ( HDPublisherDiv = document.getElementById("HDPublisherDiv") ) )
    {   
        HDPublisherDiv.innerHTML = "";
        HDPublisherIframe = document.createElement("iframe");
        HDPublisherIframe.setAttribute("frameBorder", "0");
        HDPublisherIframe.setAttribute("scrolling", "no");
        HDPublisherIframe.style.position = "relative";
        HDPublisherIframe.style.width = "440px";
        HDPublisherIframe.style.height = "540px";
        HDPublisherIframe.src = "/app/performer/hdon2.php";

        HDPublisherDiv.appendChild( HDPublisherIframe );
    }
}   

function IsHDPublisherClosed()
{
    return ( typeof( HDPublisherWindow ) == 'object' && HDPublisherWindow.closed ) ? 1 : 0;
}

 function freePreview (w, h, FlashVars) {
 	hd	=	0;
    if(!hd){
      var hd=0;
    }
    var swf = '/flash/chat/limitedFreePreview20.swf';
    if(isFreeUser() || isUser() || isRegularUser() || isVIP()) {
        swf = '/flash/chat/freePreview20.swf';
    } else {
        FlashVars = FlashVars + '&timeLimit=30000';
    }

    document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width='+w+' height='+h+' id="video_chat" align="">');
    document.writeln('<PARAM name="movie" value="'+swf+'">');
    if(hd){
      document.writeln('<param name="hd" value="1" />');
      FlashVars = FlashVars +'&hd=1';
    } else {
      document.writeln('<param name="hd" value="0" />');
      FlashVars = FlashVars +'&hd=0';
    }
    document.writeln('<param name=FlashVars value="'+FlashVars+'" />');
    document.writeln('<PARAM name="salign" value="LT">');
    document.writeln('<PARAM name="quality" value="high">');
    document.writeln('<param name="wmode" value="transparent">');
    document.writeln('<PARAM name="bgcolor" value="#006666">');
    document.writeln('<param name="allowScriptAccess" value="always">');
    document.writeln('<embed src="'+swf+'" salign="LT" FlashVars="'+FlashVars+'" allowScriptAccess="always" quality="high" bgcolor="#006666" width='+w+' height='+h+' name="video_chat" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent"/>');
    document.writeln('</OBJECT>'); 
	document.title='熟女専門 感熟ライブ ホーム';
}



