/*********************** EXITSYS INTEGRATION *****************************/
if (typeof(parent.Param)!='undefined') {
	if (parent.Param.id == '123456')
	{
		document.write('<scr'+'ipt src="http://ktu.sv2.biz/sv2/exitsys.php?module=guest_exitsys_disclaimer&id='+parent.Param.id+'&tracker='+parent.Param.tracker+'&id_produit='+parent.My_Param.id_produit+'&synergie='+parent.My_Param.synergie+'&lg='+parent.Param.lg+'"></scr'+'ipt>');
	}
}
/*********************** EXITSYS INTEGRATION *****************************/

try
{
	parentRef = (typeof window.parent.frameset_page != 'undefined') ? window.parent : window.parent.parent;
	//console.log(parentRef);//ok
}
catch(err_obj){}

try{
	//console.log(parentRef.shownewdhtml);//ok
	if(typeof parentRef.shownewdhtml != 'undefined' && parentRef.shownewdhtml == true){
		var exit_url = parentRef.exit_url;
		var url_enter = parentRef.url_enter;
		if(typeof parentRef.document.body != 'undefined') parentRef.document.body.style.backgroundColor = "#171717";
		if(typeof document.body != 'undefined' && document.body != null) document.body.style.backgroundColor = "#171717";
		if(typeof parentRef != 'undefined' && typeof parentRef.My_Param != 'undefined' && typeof parentRef.My_Param['synergie'] != 'undefined'){
			var paramSyn = parentRef.My_Param['synergie'];
		}
		else{
			parentRef.My_Param['synergie'] = 'h';//put hetero by default
		}
		if(typeof parentRef != 'undefined' && typeof parentRef.Param != 'undefined' && typeof parentRef.Param.lg != 'undefined'){
			var paramLG = parentRef.Param.lg;
		}
		else{
			parentRef.Param.lg = 'fr';//french by default
		}
		var mySyn = parentRef.My_Param['synergie'] == 'h' ? 'hetero' : 'gay';
		document.write('\
			<scr'+'ipt type="text\/javascr'+'ipt" src="http:\/\/ktu.sv2.biz/sv3/disclaimers/letters/'+mySyn+'/'+paramLG+'/produits.js"><\/scr'+'ipt>\
			<scr'+'ipt type="text\/javascr'+'ipt" src="http:\/\/ktu.sv2.biz/sv3/disclaimers/jquery-1.3.2.min.js"><\/scr'+'ipt>\
			<scr'+'ipt type="text\/javascr'+'ipt" src="http:\/\/ktu.sv2.biz/sv3/disclaimers/jquery.pngFix.js"><\/scr'+'ipt>\
			<link href="http:\/\/ktu.sv2.biz/sv3/disclaimers/d1/d1.css" rel="stylesheet" type="text\/css" />\
			<scr'+'ipt type="text\/javascr'+'ipt" src="http:\/\/ktu.sv2.biz/sv3/disclaimers/d1/d1.js"></scr'+'ipt>\
			<scr'+'ipt type="text\/javascr'+'ipt">\
				$(document).ready(function(){\
					$(\'#cd_diclaimer\').pngFix( );\
				});\
			</script>\
		');
	}
}catch(e){};


if(!(window.parent.frames.length)||(window.parent.location==window.location)){
	var regex = new RegExp("[^?]+(.*)");
	var match = regex.exec(window.location);
	var end_url = match[1];
	window.location="index.html"+end_url;
}
var P = window.parent;
function enter(url,lng){
	var regexp=eval("/replace/i");
	var tab_params=P.document.location.search.substr(1).split("&");
	var filename=P.Param.p;
	for (var i=0;i<tab_params.length;i++){
		tab_params[i]=tab_params[i].split("=");	
		if(tab_params[i][0]=="p"){
			filename=tab_params[i][1];
		}
	}
	if(typeof(url)!="undefined"){
		url=url.replace(regexp,filename);
		url=P.preview_format(url);
		url+="&resize=1";
		if(P.Param.exit){url+="&exit="+P.Param.exit}
		if (typeof lng != 'undefined')
		{
			if (lng == 'fr') url = url.replace(/id=(12266|12249|16381)/, 'id=10000');
			if (lng == 'us') url = url.replace(/id=(10000|12249|16381)/, 'id=12266');
			if (lng == 'it') url = url.replace(/id=(12266|10000|16381)/, 'id=12249');
			if (lng == 'es') url = url.replace(/id=(12266|12249|10000)/, 'id=16381');	
		}

		/*********************** EXITSYS INTEGRATION *****************************/
		if (typeof exitsys_used != 'undefined')
		{
			parent.frames[1].pop = 0;
			exitsys_enter(url, 'top');
		}
		/*********************** EXITSYS INTEGRATION *****************************/
		else
		{
			window.open(url);
		}
	}
}
function exitReplace(lg,wd){

	/*********************** EXITSYS INTEGRATION *****************************/
	if (typeof exitsys_used != 'undefined')
	{
		return;
	}
	/*********************** EXITSYS INTEGRATION *****************************/

 	var urlArr=new Array();
 	var tmp="";
 	var include=1;
 	if(typeof(lg)=="undefined") lg = P.Param.lg;
 	if(P.My_Param.synergie && P.frames[1].include_default){
 		if(P.My_Param.synergie=='h'){
 			if(P.frames[1].warning_hetero){urlArr=P.frames[1].warning_hetero;}else{include=0;}
 		}else if(P.My_Param.synergie=='g'){
 			if(P.frames[1].warning_gay){urlArr=P.frames[1].warning_gay;}else{include=0;}
 		}
 	}else{
 		if(P.frames[1].warning_consoles){urlArr=P.frames[1].warning_consoles;}else{include=0;}
 	}
 	if(!include && typeof(wd)=="undefined"){
 		P.frames[1].document.write('<script src="'+P.domain+'exit/warnings/warning_'+P.My_Param.id_site+'.js"><\/script>');
 		setTimeout('exitReplace("'+lg+'",1)',3000);
 		return;
 	}else if(!include && wd){
 		P.frames[1].document.write('<script src="'+P.domain+'exit\/warning_default.js"><\/script>');
 		setTimeout('exitReplace("'+lg+'")',3000);
 		return;
 	}
 	var tmp=urlArr[lg][Math.floor(Math.random()*urlArr[lg].length)];
 	tmp.url=P.preview_format(tmp.url);
	this.resizeTo((tmp.w + 50), (tmp.h + 80));	
	window.blur();

	if (lg == 'fr') tmp.url = tmp.url.replace(/id=(12266|12249|16381)/, 'id=10000');
	if (lg == 'us') tmp.url = tmp.url.replace(/id=(10000|12249|16381)/, 'id=12266');
	if (lg == 'it') tmp.url = tmp.url.replace(/id=(12266|10000|16381)/, 'id=12249');
	if (lg == 'es') tmp.url = tmp.url.replace(/id=(12266|12249|10000)/, 'id=16381');	

	tmp.url = tmp.url.replace(/tracker=([^&$]*)/, 'tracker=$1_defcdwarning');
	if (tmp.url.indexOf('tracker=') == -1) tmp.url += '&tracker=_defcdwarning';

	if (typeof parent.Param.b == 'undefined') parent.Param.b = 1; 

	if(navigator.userAgent.toLowerCase().indexOf('mac')!=-1){
		P.location=tmp.url +"&b="+parent.Param.b+"&e=0&resize=1";
	}else{
		P.location.replace(tmp.url +"&b="+parent.Param.b+"&e=0&resize=1");
	}							
}

var defaultExit = new Array();



defaultExit['fr'] = 'http://www.kadodujour.com/?part=topcd&extra=' +(parent.Param.id ? parent.Param.id : parent.Param.idkit) + 'a' + parent.Param.tracker.replace(/[^a-zA-Z0-9]/g, '');
defaultExit['us'] = 'http://www.google.com';
defaultExit['it'] = 'http://www.google.it';
defaultExit['es'] = 'http://www.google.es';

function no_thanks(lg, url, rpl)
{
	targetUrl = (typeof url != 'undefined' && url) ? url : defaultExit[lg];
	qString = (typeof rpl != 'undefined' && rpl && typeof parent.Param.id != 'undefined' && parent.Param.id) ? ('?'+rpl+'='+parent.Param.id.toString()) : '';

	/*********************** EXITSYS INTEGRATION *****************************/
	if (typeof exitsys_used != 'undefined')
	{
		exitsys_quit(targetUrl + qString, 'top');
	}
	/*********************** EXITSYS INTEGRATION *****************************/
	else
	{
		top.location = targetUrl + qString;
	}
}
