	////////////////////////////////////////////////////////////
	function writeActionForm() {
		
		var res = getData();
		var formStr = '<form action="'+res['url']+'" name="jsDownload" id="jsDownload" method="post">';
		formStr += '<input type="hidden" name="pData" value="'+res['pData']+'" />';				
		formStr += '<input type="hidden" name="lang" value="'+res['lang']+'" />';
		formStr += '<input type="hidden" name="skin_id" value="'+res['skin_id']+'" />';
		formStr += '</form>';	
		
		$("body").append(formStr);
	}
	
	////////////////////////////////////////////////////////////
	function initIframeSrc(iframeEL) {
		
		var res = getData();
		iframeEL.src=res['url']+"?pData="+res['pData']+"&lang="+res['lang'];
	}
	
	
	
	////////////////////////////////////////////////////////////
	//gets all the cookies from the current page an sets them in a new window specified sent as a parameter
	var setchild = function(_win){
		//get all the cookies and split them into a array
		var cookies = document.cookie.split(";");
	
		for (k in cookies){
			//split the current string into a new array
			try{
				var rr_keyval = cookies[k].split("=");
				for (m in rr_keyval)
					//cut the spaces from the beginning of the string
					while (rr_keyval[m].charAt(0)==' ') rr_keyval[m] = rr_keyval[m].substring(1,rr_keyval[m].length);
				//set a new cookie in the new window
				_win.document.cookie = rr_keyval[0] + "=" + rr_keyval[1] + "; path=/";
			}catch (err){

			}
		}
	}


	function getData(){
		
		var res = Array();
		res['url'] = 'http://online.rummyroyal.com/bo/RummyRoyal.php';
		res['skin_id'] = 7;
		var sid = (getCookie("sid"))?(getCookie("sid")):5;
		var rAFID = (getCookie("rAFID"))?(getCookie("rAFID")):'';
		var cRefID = (getCookie("cRefID"))?(getCookie("cRefID")):'';
		var cusReferrer = (getCookie("cusReferrer"))?(getCookie("cusReferrer")):'';
		var qs = (getCookie("qs"))?(getCookie("qs")):'';
		var aid = (getCookie("aid"))?(getCookie("aid")):'1';
		var bid = (getCookie("bid"))?(getCookie("bid")):'0';
		var cid = (getCookie("cid"))?(getCookie("cid")):'1';
		var lid = (getCookie("lid"))?(getCookie("lid")):'1';
		var brs = browserDetection();
		var pixLeadFlag = 0;
		if(aid == 2946 || (aid == 1866 && cid == 4456) || aid == 1650 || aid == 3239 || aid == 531){
			pixLeadFlag = 1;
		}
		res['pData'] = aid+'^'+cid+'^'+lid+'^'+bid+'^1^0^'+brs+'^'+pixLeadFlag;
		res['lang'] = 'de';
		return res;
	}
	//////////////////////////////////////////////////////////
	function browserDetection(){
		var browser = jQuery.browser;
		var curBrowser = '';
		for (br in browser){
			if (browser[br] == true) {
				curBrowser = br;
			}
		}
		switch (curBrowser) {
			case 'safari':
				return 's';
				break;
			case 'opera':
				return 'o';
				break;
			case 'msie':
				return 'i';
				break;
			case 'mozilla':
				return 'f';
				break;
			case 'chrome':
				return 'c';
				break;
			default:
				return 'u';
				break;																				
		}
	}
	$(document).ready(function() {
		$("a[id='noDownloadLink12']").click(function(event){			
			document.jsDownload.target = "win";
			var win = window.open('/blankPage.html?'+getUnixTime(),'win','width=800,scrollbars=0,height=635,left=100,top=50,resizable=1');
			setchild(win);	
			win.focus();				
			if (browserDetection() == 'f') document.jsDownload.submit();
			else jsDownload.submit();	
		});
		writeActionForm();
	});
	
	function getUnixTime()
	{
		var foo = new Date; // Generic JS date object
		var unixtime_ms = foo.getTime(); // Returns milliseconds since the epoch
		var unixtime = parseInt(unixtime_ms / 1000);	
		return unixtime;
	}
