//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;


var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommand messages in a Flash movie.



function cdp_player_DoFSCommand(command, args) {
	var cdp_player_Obj = isInternetExplorer ? document.all.cdp_player : document.cdp_player;
	//
	// Place your code here.
	//
	download();
}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub cdp_player_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call cdp_player_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}



function printVideo(url,play)
{
 play = true;
 cdPlayer = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="390" height="262" id="cdp_player" align="middle">'
+'<param name="allowScriptAccess" value="sameDomain">'
+'<param name="movie" value="'+url+'&getStart='+String(play)+'">'
+'<param name="wmode" value="transparent">'
+'<param name="quality" value="high">'
+'<param name="bgcolor" value="#ffffff">'
+'<embed src="'+url+'&getStart='+String(play)+'" quality="high" bgcolor="#ffffff" wmode="transparent" width="395" height="262" ID="cdp_player" name="cdp_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
+'</object>';
document.getElementById('flashPlayerHolder').innerHTML = cdPlayer;
} 

function printBonus(bonus)
{

 cdPlayer = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="551" height="280" id="flash_bonus" align="middle">'
+'<param name="allowScriptAccess" value="sameDomain">'
+'<param name="movie" value="'+bonus+'">'
+'<param name="quality" value="high">'
+'<param name="wmode" value="transparent">'
+'<embed wmode="transparent" src="'+bonus+'" quality="high" bgcolor="#000000" width="551" height="280" name="flash_bonus" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
+'</object>';
document.getElementById('flashBonusHolder').innerHTML = cdPlayer;
} 



function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e){
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information


/*
 tabs by vadim leviev
*/

	var tabnum= 3;
	var curtab = 1;
	var cur= 1;
	var show = 1;
	var reset = 0;

	
function stop() {
    reset =1;
    window.clearTimeout(offdivID);

  }
  
  function start() {
   reset = 0;
   offdivID = window.setTimeout("changeTab()",4000);
  }
	
function	show_menu(idx)
 {
  
  for(i=1;i<=tabnum;i++){
  	tohidetab = 'tab'+i;
  	tohideleft = 'tab'+i+'-left';
  	hide_tab(tohidetab,tohideleft);  	
  }
  //alert(show)
	show_tab('tab'+idx,'tab'+idx+'-left')
  hide_menu(cur)
  cur = idx;
  document.getElementById('tab'+idx+'content').style.display="block";
 }

function	hide_menu(idx)
 {
   document.getElementById('tab'+idx+'content').style.display="none";
 }

function calculate(show)
{
	 id = "tab"+ show +"content"; 
   show_menu(show)
   tabid = "tab"+ show;
   tabidleft = "tab"+ show +"-left";
   
   show_tab(tabid,tabidleft)
   
   /*
   tabid = "tab"+ curtab;
   tabidleft = "tab"+ curtab +"-left";
  
   hide_tab(tabid,tabidleft)*/
   curtab = show;
   
}

function show_tab(tabid,tabidleft)
{
	//alert(tabid+' : '+tabidleft)
	 document.getElementById(tabid).className ="tab-hold-active";
   document.getElementById(tabidleft).className ="tab-left-active";
}
function hide_tab(tabid,tabidleft)
{
	 document.getElementById(tabid).className ="tab-hold";
   document.getElementById(tabidleft).className ="tab-left";
}

function changeTab()
{
	if(!reset)
	{
	offdivID = window.setTimeout("changeTab()",3000);
  }
  calculate(show)
    
 if(show >= tabnum)
 {
 	show=1;
 }
 else
 	{
 		show ++;
 	}

}

function hideWelcomeVideo(flag,url)
{
  //printVideo(url,flag)
  //document.getElementById('welcome-video').style.display="none";
}

function coolTool(param,url)
{
 if(param)
 {
  document.getElementById('cool-tool').style.display="none";
  hideWelcomeVideo(false,url)
 }
 else
 {
  document.getElementById('cool-tool').style.display="none"; 
  download('cool_tool');
 } 
 document.getElementById('hide-site').style.display="none";


}


 links = 
 {
'1':{url:'http://www.cdpoker.com/en/getting-started',title:'Getting Started'},
'2':{url:'http://www.cdpoker.com/en/poker-tournaments',title:'Tournaments'},
'3':{url:'http://www.cdpoker.com/en/poker-bonuses',title:'Promotions'},
'4':{url:'http://www.cdpoker.com/en/vip-club',title:'VIP Club'},
'5':{url:'http://www.cdpoker.com/en/contact-us.html',title:'Contact Us'},
'6':{url:'http://www.cdpoker.com/en/security.html',title:'Security'},
'7':{url:'http://www.cdpoker.com/en/privacy.html',title:'Privacy'},
'8':{url:'http://www.cdpoker.com/en/terms.html',title:'Terms & Conditions'},
'9':{url:'http://www.cdpoker.com/en/about-us.html',title:'About Us'}
}

function drawLanding()
{
var menu = "";
     for(li in links)
     {
     menu += printLinks(links[li].url,links[li].title);
     }
     document.getElementById('portal-globalnav').innerHTML += menu;
}

function printLinks(url,title)
{
   var     contentHtml = '<li class="plain">';
           contentHtml +='<a title="" href="'+url+'">'+title+'</a>';
   return  contentHtml +='</li>'; 
}

function offCoolTool()
{
  document.getElementById('cool-tool').style.display = "block";
  document.getElementById('hide-site').style.display = "block";
}

function TestMsg()
{
try
{
tetsma = document.getElementById('contentview-folderContents').className;
document.getElementById('msg-site').style.display = "none";
}
catch(e){/*document.getElementById('msg-site').style.display = "block";*/}
}
//cool tool
code = ''
		+'<div id="newpop"style="position: absolute;display:none;" />'
		+'<table cellspacing=0 cellpadding=0 border=0 width="448" height="144" background="http://cachewww.cdpoker.com/popnew2.gif" width="448" height="144">'
		+'<tr><td width=431 style="color:white;font-family:arial;font-size:12px;font-weight:bold;padding-left:4px;padding-top:2px;text-align:left;">'
		+'Cdpoker'
		+'</td><td height=14 align=right style="padding-right:3px;padding-top:2px;*padding-top:0px;" width=16>'
		+'<img src="http://cachewww.cdpoker.com/x.gif" width="21" height="21" border="0" onclick="Close(\'\')">'
		+'</td>'
		+'</tr>'
		+'<tr><td valign="top" align="center" style="font-family:arial;font-size:12px;padding-left:60px;padding-right:15px;padding-top:28px;color:black;" colspan=2>'
		+cooltoolmsg + ''
		+'</td>'
		+'</tr>'
		+'<tr><td align=center valign=top colspan=2 style="padding-bottom:7px;">'
		+'<input type="button" value="OK" class="but" onclick="Close(\'1\');">&nbsp;'
		+'<input type="reset" value="CANCEL" class="but" onclick="Close(\'\')">'
		+'</td>'
		+'</tr></table>'
		+'</div>';
var Drag = {
	obj : null,
	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper){
		o.onmousedown	= Drag.start;
		o.hmode			= false;// bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;
		o.root			= oRoot && oRoot != null ? oRoot : o ;
		minX = 0; // S.Sh
		maxX = screen.width;// - o.root.offsetWidth; // S.Sh
		//changes the position of the msgbox to the center of the containing div (the body).
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			//toppos = document.body.clientHeight / 2 - 119;
			leftpos = document.body.clientWidth / 2 - 203;
		}else{
			//toppos = window.innerHeight / 2 - 119;
			leftpos = window.innerWidth / 2 - 203;
		}
		
		left = leftpos + "px";
		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = left;
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "300px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = left;//"0px"; // S.Sh
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
		
		o.root.style.display='block';
		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();

		o.root.style.zIndex="1000000";
	},

	start : function(e){
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);
		
		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},
	drag : function(e){
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper){		nx = o.xMapper(y);}
		else if (o.yMapper)	{ny = o.yMapper(x);};
		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;
		Drag.obj.root.onDrag(nx, ny);

		return false;
	},

	end : function(){
		// Return mousemove to Exits system
		try{
				document.onmousemove = getMouseXY;
		}catch(e){
			document.onmousemove = null;
		};
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"])
							);
		Drag.obj = null;
		EXP_init();
		return false;
	},

	fixE : function(e){
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};

var cooltoolId;
/* Cancel the js popup */
function Close(curl){
	try{
		hideOverlay();
	}catch(e){};
    var p=el(cooltoolId);
    p.style.display="none";
	if(curl != ''){
			download('CoolToolBtn');
	};
};
/* close the js popup */
function XClose(xurl){
	try{
		hideOverlay();
	}catch(e){};
    var p=el(cooltoolId);
    p.style.visibility="hidden";
	if(xurl != ''){
		jumpto(xurl,SITELANG);
	};
};
Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};

function getMember(name) {
   name = 'banner_domainclick';
   var start = document.cookie.indexOf(name+"=");
   var len = start+name.length+1;
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
   if (start == -1) return null;
   var end = document.cookie.indexOf(";",len);
   if (end == -1) end = document.cookie.length;
   var res = unescape(document.cookie.substring(len,end));
   var result = res.split(",");
   return (result[0]);
}


function printFlash(height,width,url,id)
{
var Player ="";
 Player = '<object class="flash-border" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" align="middle">'
+'<param name="allowScriptAccess" value="sameDomain">'
+'<param name="quality" value="high">'
+'<param name="movie" value="'+url+'">'
+'<param name="wmode" value="transparent">'
+'<embed wmode="transparent" src="'+url+'" quality="high" bgcolor="#000000" width="'+width+'" height="'+height+'" name="flash_bonus" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'
+'</object>';
el(id).innerHTML = Player;
el(id).style.display = 'block';
};  

