if (typeof yestools_url == "undefined") var yestools_url = '';
if (typeof popYesSound == "undefined") var popYesSound = 0;
if (typeof designType == "undefined") var designType = 1;
if (typeof popYesSoundLoop == "undefined") {
	var popYesSoundLoop = (popYesSound>0) ? true : false;
} else {
	popYesSoundLoop = (popYesSound>0 && popYesSoundLoop==1) ? true : false;
}
if (typeof picType == "undefined") var picType = 'hard';
if (typeof popYesMove == "undefined") var popYesMove = 'right-bottom-top';

var apopParam = new Array;
apopParam['path']=yestools_url;
apopParam['sound']=popYesSound;
apopParam['loop']=false;
if (typeof ALPHA != "undefined") apopParam['alpha']=ALPHA;

if (typeof popYesNoCookie != "undefined") apopParam['nocookie']=true;

switch (popYesMove)
{
	case 'right-bottom-left':
		apopParam['position']='right';
		apopParam['direction']='left';
	break;
	case 'right-top-left':
		apopParam['position']='up';
		apopParam['direction']='left';
	break;
	case 'right-top-bottom':
		apopParam['position']='right';
		apopParam['direction']='down';
	break;
	case 'left-bottom-right':
		apopParam['position']='left';
		apopParam['direction']='right';
	break;
	case 'left-bottom-top':
		apopParam['position']='left';
		apopParam['direction']='up';
	break;
	case 'left-top-right':
		apopParam['position']='up';
		apopParam['direction']='right';
	break;
	case 'left-top-bottom':
		apopParam['position']='up';
		apopParam['direction']='down';
	break;
	default:
		// right-bottom-top
		apopParam['position']='right';
		apopParam['direction']='up';
	break;
}

document.write('<link href="css/styles.css" rel="stylesheet" type="text/css">');
document.write('<link href="css/sizes.css" rel="stylesheet" type="text/css">');
document.write('<style type="text/css">.yes_loading { background:url(scripts/img/yes_loading.gif) 50% 50% no-repeat; }</style>');

var MAX_CITY_CHARS = 10;
function yes_open_msglink(closeme)
{
	if (closeme) {
		apopCloseMe('yes_cookie');
		return;
	}
	apopCookie('yes_cookie');
	if (targetType == '_blank')	window.open(targetUrl);
	else window.location = targetUrl;

}
function get_random_number(min, max)
{
	rand = min + Math.floor(Math.random()*(max-min+1));
	return rand;
}
function pad(num)
{
	if (num<10) return '00'+num;
	if (num<100) return '0'+num;
	return num;
}
function get_max(picType,format)
{
	if (picType == 'soft' && format == '100x100') return 335;
	if (picType == 'soft' && format == '120x160') return 130;
	if (picType == 'soft' && format == '150x150') return 335;
	if (picType == 'sexy' && format == '100x100') return 136;
	if (picType == 'sexy' && format == '120x160') return 200;
	if (picType == 'sexy' && format == '150x150') return 136;
	if (picType == 'hard' && format == '100x100') return 150;
	if (picType == 'hard' && format == '120x160') return 200;
	if (picType == 'hard' && format == '150x150') return 150;
}
function get_max_mature(picType,format)
{
	if (picType == 'soft' && format == '100x100') return 100;
	if (picType == 'soft' && format == '120x160') return 50;
	if (picType == 'soft' && format == '150x150') return 100;
	if (picType == 'sexy' && format == '100x100') return 50;
	if (picType == 'sexy' && format == '120x160') return 50;
	if (picType == 'sexy' && format == '150x150') return 50;
	if (picType == 'hard' && format == '100x100') return 50;
	if (picType == 'hard' && format == '120x160') return 50;
	if (picType == 'hard' && format == '150x150') return 50;
}

infoYesSize = '100x100';
if (typeof popYesSize == "undefined") var popYesSize = '300x150';
if (popYesSize=='300x150') infoYesSize = '100x100';
if (popYesSize=='300x300') infoYesSize = '120x160';
if (popYesSize=='200x300') infoYesSize = '150x150';
apopParam['size']=popYesSize;

//var allNames = [];
var allSentences ={'soft':  [ ],'sexy':  [],'hard':   []};

var allSentencesMature ={'soft':  [],'sexy':  [], 'hard':   []};
var yes_content = '';
var backup_func = apopParam['newcontent']=function(winName) 
{
	if ((typeof content_niche != 'undefined') && (content_niche == 'mature'))
	{
		var randomAge = get_random_number(35,45);
		var randomName = allNames[get_random_number(0,allNames.length-1)];
		var randomText = allSentencesMature[picType][get_random_number(0,allSentencesMature[picType].length-1)];
	} else {
		var randomAge = get_random_number(20,31);
		var randomName = allNames[get_random_number(0,allNames.length-1)];
		var randomText = allSentences[picType][get_random_number(0,allSentences[picType].length-1)];
	}
	if (typeof showCity == 'undefined') showCity = '';
	if (typeof geoip_city == 'undefined') geoip_city = '';
	var _fl = randomName.substr(0,1);
	var de_text = (_fl.match(/^[AEUOIY]/)) ? "d'" : 'de ';
	if (showCity && geoip_city.length <= MAX_CITY_CHARS) { var tmp_city = ' '+geoip_city; } 
	else { var tmp_city = ''; }

	var cross_jsfunction = (typeof popYesCross != "undefined") ? 'javascript:yes_open_msglink(true)' : 'javascript:yes_open_msglink(false)';

	var yes_content = '';
	yes_content += ('<!-- all -->');
	yes_content += ('<div id="ychat_dhtml" class="size'+popYesSize+'">');
	yes_content += ('	<div class="ytop yclearfix"><span class="yright"><a href="javascript:yes_open_msglink(true)" class="ydhtml_close">Close</a></span><span class="yleft"></span></div>');
	yes_content += ('	<div class="ywrap">');
	yes_content += ('	<div class="ydhtml_wrap yclearfix">');
	yes_content += ('		<div class="ysize">');
	yes_content += ('			<img class="ydhtml_pic yes_loading" src="'+imgSrc+'" alt="" border="0" width="75" height="75" id="yimg">');
	yes_content += ('			<div class="ywrapin yclearfix">');
	yes_content += ('				<div class="ydhtml_name_ans">Les derniers gagnants : </div>');
	if (winName=='init') {
		yes_content += ('				<div class="ytop_chat"></div>');
	} else {
		yes_content += ('				<div class="ytop_chat"></div>');
	}
	yes_content += ('				<div class="ydhtml_text"><p>'+randomName+'<br /></p></div>');
	yes_content += ('          	</div>');
	yes_content += ('			<!--p><a href="javascript:yes_open_msglink(false)" class="ydhtml_click">cliquez ici pour lui r&eacute;pondre</a></p-->');
	yes_content += ('       	</div>');
	yes_content += ('	</div>');
	yes_content += ('	</div>');
	yes_content += ('</div>');
	

	var apopWin = document.getElementById('apopWin_'+winName);
	if (!apopWin) return yes_content;
	apopWin.innerHTML = yes_content;
};
apopParam['content']=apopParam['newcontent']('init');