function gup( name )
{
  var results = eval('yesmsng_thmbbanner.'+name);
  if( results == null)
    return "";
  else
    return results;
}

function in_array(needle, haystack, strict) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: true

    var found = false, key, strict = !!strict;

    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }

    return found;
}



try{
	yesmsng_thmbbanner.content_niche = gup('content_niche')? gup('content_niche'):"normal";
	yesmsng_thmbbanner.tracker += "_Ytmb";
	var c_n = gup('content_niche');
	var t_n = gup('thumb_niche');
	var t_size = gup('thumb_size');
	var loadGirls = gup('thumb_numb')*gup('thumb_factor');
	var factor = (gup('ban_type') == "vertical")? gup('thumb_factor'):gup('thumb_numb');
	if (gup('ban_type') == "horizontal" && gup('thumb_numb') == 1 && gup('thumb_factor') > 1){
		yesmsng_thmbbanner.ban_type = "vertical";
		yesmsng_thmbbanner.thumb_numb = gup('thumb_factor');
	}
	var loadAnim = 0;
	var loadMen = 0;
	var thumbsToShow = loadGirls;
	if(gup('slide')){
		loadGirls*=2;
		//document.write('adding more tumbs because of the slideshow: new num:' + loadGirls + '<br>');
	}

	if(gup('show_men')){
		//document.write('thumbsToShow = '+thumbsToShow+'<br>')
		if(thumbsToShow >= 10) loadMen = 3;
		else if(thumbsToShow >= 5) loadMen = 2;
		else if(thumbsToShow == 1) loadMen = 0;
		else loadMen = 1;
		loadGirls-=loadMen;
	}

	if(gup('show_anim')){
		//document.write('thumbsToShow = '+thumbsToShow+'<br>')
		if(thumbsToShow >= 10) loadAnim = 3;
		else if(thumbsToShow >= 5) loadAnim = 2;
		else if(thumbsToShow == 1) loadAnim = 0;
		else loadAnim = 1;
		loadGirls-=loadAnim;
	}

	document.write('<scr'+'ipt type="text/javascript" src="http://media.yes-messenger.com/banners/lib/jquery-1.2.3.pack.js"></scr'+'ipt>');

	if(gup('slide')){
	document.write('\
	<scr'+'ipt type="text/javascript" src="http://media.yes-messenger.com/banners/lib/jquery.jcarousel.pack.js"></scr'+'ipt>\
	<link rel="stylesheet" type="text/css" href="http://media.yes-messenger.com/banners/lib/jquery.jcarousel.css" />\
	');
	}


	//RAND
	function rand( min, max ) {
		// http://kevin.vanzonneveld.net
		// +   original by: Leslie Hoare
		// *     example 1: rand(1, 1);
		// *     returns 1: 1

		if( max ) {
			return Math.floor(Math.random() * (max - min + 1)) + min;
		} else {
			return Math.floor(Math.random() * (min + 1));
		}
	}
	//RAND

	//SPECIALCHARS
	function htmlentities( string ){
	    // http://kevin.vanzonneveld.net
	    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	    // %          note: table from http://www.the-art-of-web.com/html/character-codes/
	    // *     example 1: htmlentities('Kevin & van Zonneveld');
	    // *     returns 1: 'Kevin &amp; van Zonneveld'

	    var histogram = {}, code = 0, tmp_arr = [];

	    histogram['34'] = 'quot';
	    histogram['38'] = 'amp';
	    histogram['60'] = 'lt';
	    histogram['62'] = 'gt';
	    histogram['160'] = 'nbsp';
	    histogram['161'] = 'iexcl';
	    histogram['162'] = 'cent';
	    histogram['163'] = 'pound';
	    histogram['164'] = 'curren';
	    histogram['165'] = 'yen';
	    histogram['166'] = 'brvbar';
	    histogram['167'] = 'sect';
	    histogram['168'] = 'uml';
	    histogram['169'] = 'copy';
	    histogram['170'] = 'ordf';
	    histogram['171'] = 'laquo';
	    histogram['172'] = 'not';
	    histogram['173'] = 'shy';
	    histogram['174'] = 'reg';
	    histogram['175'] = 'macr';
	    histogram['176'] = 'deg';
	    histogram['177'] = 'plusmn';
	    histogram['178'] = 'sup2';
	    histogram['179'] = 'sup3';
	    histogram['180'] = 'acute';
	    histogram['181'] = 'micro';
	    histogram['182'] = 'para';
	    histogram['183'] = 'middot';
	    histogram['184'] = 'cedil';
	    histogram['185'] = 'sup1';
	    histogram['186'] = 'ordm';
	    histogram['187'] = 'raquo';
	    histogram['188'] = 'frac14';
	    histogram['189'] = 'frac12';
	    histogram['190'] = 'frac34';
	    histogram['191'] = 'iquest';
	    histogram['192'] = 'Agrave';
	    histogram['193'] = 'Aacute';
	    histogram['194'] = 'Acirc';
	    histogram['195'] = 'Atilde';
	    histogram['196'] = 'Auml';
	    histogram['197'] = 'Aring';
	    histogram['198'] = 'AElig';
	    histogram['199'] = 'Ccedil';
	    histogram['200'] = 'Egrave';
	    histogram['201'] = 'Eacute';
	    histogram['202'] = 'Ecirc';
	    histogram['203'] = 'Euml';
	    histogram['204'] = 'Igrave';
	    histogram['205'] = 'Iacute';
	    histogram['206'] = 'Icirc';
	    histogram['207'] = 'Iuml';
	    histogram['208'] = 'ETH';
	    histogram['209'] = 'Ntilde';
	    histogram['210'] = 'Ograve';
	    histogram['211'] = 'Oacute';
	    histogram['212'] = 'Ocirc';
	    histogram['213'] = 'Otilde';
	    histogram['214'] = 'Ouml';
	    histogram['215'] = 'times';
	    histogram['216'] = 'Oslash';
	    histogram['217'] = 'Ugrave';
	    histogram['218'] = 'Uacute';
	    histogram['219'] = 'Ucirc';
	    histogram['220'] = 'Uuml';
	    histogram['221'] = 'Yacute';
	    histogram['222'] = 'THORN';
	    histogram['223'] = 'szlig';
	    histogram['224'] = 'agrave';
	    histogram['225'] = 'aacute';
	    histogram['226'] = 'acirc';
	    histogram['227'] = 'atilde';
	    histogram['228'] = 'auml';
	    histogram['229'] = 'aring';
	    histogram['230'] = 'aelig';
	    histogram['231'] = 'ccedil';
	    histogram['232'] = 'egrave';
	    histogram['233'] = 'eacute';
	    histogram['234'] = 'ecirc';
	    histogram['235'] = 'euml';
	    histogram['236'] = 'igrave';
	    histogram['237'] = 'iacute';
	    histogram['238'] = 'icirc';
	    histogram['239'] = 'iuml';
	    histogram['240'] = 'eth';
	    histogram['241'] = 'ntilde';
	    histogram['242'] = 'ograve';
	    histogram['243'] = 'oacute';
	    histogram['244'] = 'ocirc';
	    histogram['245'] = 'otilde';
	    histogram['246'] = 'ouml';
	    histogram['247'] = 'divide';
	    histogram['248'] = 'oslash';
	    histogram['249'] = 'ugrave';
	    histogram['250'] = 'uacute';
	    histogram['251'] = 'ucirc';
	    histogram['252'] = 'uuml';
	    histogram['253'] = 'yacute';
	    histogram['254'] = 'thorn';
	    histogram['255'] = 'yuml';

	    for (i = 0; i < string.length; ++i) {
	        code = string.charCodeAt(i);
	        if (code in histogram) {
	        	document.write('converting ' + string[i] + ' ('+code+')');
	            tmp_arr[i] = '&'+histogram[code]+';';
	            document.write(' to ' + '&'+histogram[code]+';' + '<br>');
	        } else {
	            tmp_arr[i] = string.charAt(i);
	        }
	    }

	    return tmp_arr.join('');
	}
	//SPECIALCHARS


	//rand js path
	function getRandJSPath(x){
		var rand_js_dir = rand(1,x);
		rand_js_dir = (rand_js_dir < 10)? "0"+rand_js_dir:rand_js_dir;
		return rand_js_dir;
	}
	//

	//got from loadThumbs()
	if(typeof c_n == 'undefined' || c_n == '') c_n = 'normal';
	if(c_n == 'mature/') c_n = 'mature';
	if(c_n == 'BU') c_n = 'arab';
	if(c_n == 'J') c_n = 'asiat';
	if(c_n == 'B') c_n = 'black';
	//document.write('c_n = '+c_n+'<br>');
	if(typeof t_n == 'undefined' || t_n == '') t_n = 'soft';
	if(typeof t_size == 'undefined' || t_size == '') t_size = '100x100';

	var rand_js_dir = getRandJSPath(2);

	var includes_arr = Array();

	if(typeof loadGirls != 'undefined' && loadGirls > 0) includes_arr[includes_arr.length++] = 'http://media.yesmessenger.com/js/00/models-'+c_n+'-'+t_n+'-'+t_size+'-'+'no'+'-'+'girl'+'.js';

	if(loadGirls > 20) includes_arr[includes_arr.length++] = 'http://media.yesmessenger.com/js/big/00/models-'+c_n+'-'+t_n+'-'+t_size+'-'+'no'+'-'+'girl'+'.js';
	
	if(typeof loadAnim  != 'undefined' && loadAnim  > 0) includes_arr[includes_arr.length++] = 'http://media.yesmessenger.com/js/'+rand_js_dir+'/models-'+c_n+'-'+t_n+'-'+t_size+'-'+'an'+'-'+'girl'+'.js';
		
	if(typeof loadMen  != 'undefined' && loadMen  > 0) includes_arr[includes_arr.length++] = 'http://media.yesmessenger.com/js/'+rand_js_dir+'/models-'+c_n+'-'+'soft'+'-'+t_size+'-'+'no'+'-'+'men'+'.js';


	for(var i = 0; i < includes_arr.length; i++){
		//document.write('loading JS: '+includes_arr[i]+'<br>');
		document.write('<script src="'+includes_arr[i]+'"></script>');
	}
	//got from loadThumbs() end



	//var debugFromThumbs = true;

	//additional
	document.write('<scr'+'ipt src="http://media.yesmessenger.com/getThumbs.js?123"></scr'+'ipt>');
	document.write('<scr'+'ipt src="http://media.yesmessenger.com/browserDetect.js"></scr'+'ipt>');
	document.write('<scr'+'ipt src="http://pub.sv2.biz/geo_location_array.php"></scr'+'ipt>');
	document.write('<scr'+'ipt src="http://pub.sv2.biz/geo_location.php"></scr'+'ipt>');
//	document.write('<scr'+'ipt src="http://media.camsympa.com/promo/sitelinks.js"></scr'+'ipt>');
    var bannerScriptUrl = 'http://outils.yesmessenger.com/js/real.js';
//	var bannerScriptUrl = 'http://svn.carpediem.fr/devs/jan-dev/yesmessenger/outils/js/real.js?123';
//	var bannerScriptUrl = 'http://192.168.15.130/test/rencontres/new_real.js';
	//document.write('loading real banner script!<br>');
	document.write('<scr'+'ipt src="'+bannerScriptUrl+'"></scr'+'ipt>');
	//

} catch(e){
	document.write('Helper JS error: ' + e + '<br>');
}
function add_onload (func)
{
  var oldonload=window.onload;
  if (typeof(window.onload)!='function') { window.onload=function(){ eval(func); }; }
  else { window.onload=function(){ oldonload(); eval(func); }; }
};
