﻿// Variablen
var psyma_cookie = true; //  PSYMA COOKIE - ZUR LIVE-SCHALTUNG BITTE AKTIVIEREN!!!

var psyma_samplingRate = new Object();
psyma_samplingRate['uk'] = 26;
psyma_samplingRate['fr'] = 20;
psyma_samplingRate['it'] = 0;
psyma_samplingRate['de'] = 0;
psyma_samplingRate['se'] = 0;
psyma_samplingRate['ru'] = 0;

var psyma_entry_page = location.href; // Einstiegsseite
var screen_width = screen.width; // Screenwidth
var screen_height = screen.height; // Screenheight

var domain_check_url = new Object();
domain_check_url['uk'] = "nissan.co.uk";
domain_check_url['fr'] = "nissan.fr";
domain_check_url['it'] = "nissan.it";
domain_check_url['de'] = "nissan.de";
domain_check_url['se'] = "nissan.se";
domain_check_url['ru'] = "nissan.ru";

var psyma_popupURL = new Object();
psyma_popupURL['uk'] = 'http://psyma-surveys.com/uc/abuk_15_nissan/';
psyma_popupURL['fr'] = 'http://psyma-surveys.com/uc/abfr08_nissan/';
psyma_popupURL['it'] = 'http://psyma-surveys.com/uc/abit10_nissan/';
psyma_popupURL['de'] = 'http://psyma-surveys.com/uc/abde20_nissan/';
psyma_popupURL['se'] = 'http://psyma-surveys.com/uc/abse06_nissan/';
psyma_popupURL['ru'] = 'http://psyma-surveys.com/uc/abru04_nissan/';

function psyma_get_expiration_date()
{
	var psyma_day_offset = 30;
	var psyma_milli_offset = psyma_day_offset * 1000 * 60 * 60 * 24;
	var psyma_now = new Date();
	psyma_participation_exp = new Date(psyma_now.valueOf() + psyma_milli_offset);
	return psyma_participation_exp;
}

var psyma_cookie_exp = psyma_get_expiration_date();

// cookie name
var psyma_cookie_id = "psyma_launched";

// get cookie
function get_psyma_cookie(a)
{
	if ( psyma_cookie )
	{
		var c=document.cookie.split(a+"=");
		return (c.length>1)?unescape(c[1].split(";")[0]):"";
	}
	else
	{
		return false;
	}
}

// set cookie
function set_psyma_cookie(name, value, path, domain, secure, expires)
{
	if ( psyma_cookie )
	{
		document.cookie =
		name + "="
		+ escape(value)
		+ ((path) ? "; path=" + path : "")
		+ ((expires) ? "; expires=" + expires.toGMTString() : "")
		+ ((domain) ? "; domain=" + domain : "")
		+ ((secure) ? "; secure" : "");
	}
}

// Browser-Check
function psyma_check_browser(){
	var agt=navigator.userAgent.toLowerCase();
	if(agt.indexOf("opera") != -1) return 'Opera';
	if(agt.indexOf("staroffice") != -1) return 'Star Office';
	if(agt.indexOf("webtv") != -1) return 'WebTV';
	if(agt.indexOf("beonex") != -1) return 'Beonex';
	if(agt.indexOf("chimera") != -1) return 'Chimera';
	if(agt.indexOf("chrome") != -1) return 'Chrome';
	if(agt.indexOf("netpositive") != -1) return 'NetPositive';
	if(agt.indexOf("phoenix") != -1) return 'Phoenix';
	if(agt.indexOf("firefox") != -1) return 'Mozilla Firefox';
	if(agt.indexOf("safari") != -1) return 'Safari';
	if(agt.indexOf("skipstone") != -1) return 'SkipStone';
	if(agt.indexOf("msie 6.") != -1) return 'Internet Explorer 6';
	if(agt.indexOf("msie 7.") != -1) return 'Internet Explorer 7';
	if(agt.indexOf("msie 8.") != -1) return 'Internet Explorer 8';
	if(agt.indexOf("netscape") != -1) return 'Netscape';
	if(agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
	if(agt.indexOf('\/') != -1){
		if(agt.substr(0,agt.indexOf('\/')) != 'mozilla'){return navigator.userAgent.substr(0,agt.indexOf('\/'));}
		else{return 'Netscape';}
	}
	else if(agt.indexOf(' ') != -1){return navigator.userAgent.substr(0,agt.indexOf(' '));}
	else{return navigator.userAgent;}
}

var psyma_browser_name = psyma_check_browser();

// View-Port
var viewportwidth = 0;
var viewportheight = 0;
// Mozilla / Netscape / Opera / IE7
if(typeof window.innerWidth != 'undefined'){
	viewportwidth = window.innerWidth,
	viewportheight = window.innerHeight
}
// IE6
else if(typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0){
	viewportwidth = document.documentElement.clientWidth,
	viewportheight = document.documentElement.clientHeight
}
// older IEs
else{
	if(typeof(document.getElementsByTagName('body')) == 'object'){
		// IE 6 or IE 7
		viewportwidth = document.getElementsByTagName('body').clientWidth,
		viewportheight = document.getElementsByTagName('body').clientHeight
	}
	else{
		// old IEs
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
}
var viewport = viewportwidth+'x'+viewportheight;

function psyma_accept_button(locale)
{

	var psyma_zwischenseite = new Date();
	var psyma_zwischenseite_zeit = psyma_zwischenseite.getTime();

	var psyma_popupURL_parameters = new Object(); // Complete Survey URL
	psyma_popupURL_parameters['uk'] = "?a=0&b=" + psyma_zwischenseite_zeit + "&c="+viewport+"&d="+psyma_browser_name+"&e="+screen_width+"x"+screen_height+"&f="+psyma_entry_page;
	psyma_popupURL_parameters['fr'] = "?a=0&b=" + psyma_zwischenseite_zeit + "&c="+viewport+"&d=UNDEFINED&e="+psyma_browser_name+"&f="+screen_width+"x"+screen_height+"&g="+psyma_entry_page;
	psyma_popupURL_parameters['it'] = "?a=1&b=" + psyma_zwischenseite_zeit + "&c=" + psyma_entry_page;
	psyma_popupURL_parameters['de']= "?a=" + psyma_zwischenseite_zeit + "&b=" + psyma_entry_page;
	psyma_popupURL_parameters['se']= "?a=" + psyma_zwischenseite_zeit + "&b=" + psyma_entry_page;
	psyma_popupURL_parameters['ru']= "?a=" + psyma_zwischenseite_zeit + "&b=" + psyma_entry_page;

	var psymaPopupURL = psyma_popupURL[locale] + psyma_popupURL_parameters[locale];
	var domain_check_text = new Object();
	domain_check_text['uk'] = "window.setTimeout(\"checkParent()\", 500);" +
	"window.opener.focus();" +
	"function openSurvey(){document.location.href = psyma_popupURL;}" +
	"function checkParent(){" +
	"if(window.opener){" +
	"try{psyma_referrer = window.opener.location.href;}" +
	"catch(e){openSurvey();return;}" +
	"if(psyma_referrer.indexOf(\"nissan.co.uk\") > -1){window.setTimeout(\"checkParent()\", 500);}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"<\/script>" +
	"<html>" +
	"<head>" +
	"<title>Nissan online survey</title>" +
	"<style>" +
	"#header_container {width: 100%; height: 75px; margin-top: 10px;}" +
	"#header_table {width: 100%; height: 75px;}" +
	"a:link, a:active, a:visited, a:hover{color: #093; text-decoration: underline;}" +
	"a:hover{text-decoration: none;}" +
	"</style>" +
	"</head>" +
	"<body>" +
	"<div id=\"header_container\">" +
	"<table id=\"header_table\" cellspacing=\"0\">" +
	"<tr>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"<td style=\"width: 15px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_left.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: auto; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg.gif') top left repeat-x;\"><div id=\"por-logo\"><img src=\"http://scripts.psyma.com/img/prc.gif\" alt=\"Psyma Research+Consulting Logo\"/></div></td>" +
	"<td style=\"width: 17px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_right.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"</tr>" +
	"</table>" +
	"</div>" +
	"<div style=\"padding: 0 7px 0 10px;\">" +
	"<p style=\"font-family: arial; font-size: 16px; font-weight: bold;\">Thank you very much for your willingness to participate!</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">In this window, the survey will be started automatically after your visit to the Nissan website. </p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">Please continue your visit on the website and only fill in the questionnaire after you have finished your visit.</p>" +
	"<p style=\"font-size: 10px; font-family: arial;\">In case the survey doesn't start automatically <u>after your website visit</u> as described above, please click <a href=\"javascript: openSurvey();\">here</a>.</p>" +
	"</div>" +
	"</body>" +
	"</html>";

	domain_check_text['fr'] = "window.setTimeout(\"checkParent()\", 500);" +
	"window.opener.focus();" +
	"function openSurvey(){document.location.href = psyma_popupURL;}" +
	"function checkParent(){" +
	"if(window.opener){" +
	"try{psyma_referrer = window.opener.location.href;}" +
	"catch(e){openSurvey();return;}" +
	"if(psyma_referrer.indexOf(\"nissan.fr\") > -1){window.setTimeout(\"checkParent()\", 500);}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"<\/script>" +
	"<html>" +
	"<head>" +
	"<title>Nissan Enqu&ecirc;te en ligne</title>" +
	"<style>" +
	"#header_container {width: 100%; height: 75px; margin-top: 10px;}" +
	"#header_table {width: 100%; height: 75px;}" +
	"a:link, a:active, a:visited, a:hover{color: #093; text-decoration: underline;}" +
	"a:hover{text-decoration: none;}" +
	"</style>" +
	"</head>" +
	"<body>" +
	"<div id=\"header_container\">" +
	"<table id=\"header_table\" cellspacing=\"0\">" +
	"<tr>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"<td style=\"width: 15px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_left.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: auto; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg.gif') top left repeat-x;\"><div id=\"por-logo\"><img src=\"http://scripts.psyma.com/img/prc.gif\" alt=\"Psyma Research+Consulting Logo\"/></div></td>" +
	"<td style=\"width: 17px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_right.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"</tr>" +
	"</table>" +
	"</div>" +
	"<div style=\"padding: 0 7px 0 10px;\">" +
	"<p style=\"font-family: arial; font-size: 16px; font-weight: bold;\">Merci de votre volont&eacute; de participer &agrave; l'enqu&ecirc;te!</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">Apr&egrave;s votre visite du site web de Nissan, une enqu&ecirc;te s'affichera automatiquement dans cette fen&ecirc;tre.</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">Veuillez continuer votre visite du site web et r&eacute;pondez ensuite &agrave; l'enqu&ecirc;te.</p>" +
	"<p style=\"font-size: 10px; font-family: arial;\">Appuyez <a href=\"javascript: openSurvey();\">ici</a> si l'enqu&ecirc;te ne s'affiche pas apr&egrave;s votre visite comme d&eacute;crit ci-dessus.</p>" +
	"</div>" +
	"</body>" +
	"</html>";

	domain_check_text['it'] = "window.setTimeout(\"checkParent()\", 500);" +
	"window.opener.focus();" +
	"function openSurvey(){document.location.href = psyma_popupURL;}" +
	"function checkParent(){" +
	"if(window.opener){" +
	"try{psyma_referrer = window.opener.location.href;}" +
	"catch(e){openSurvey();return;}" +
	"if(psyma_referrer.indexOf(\"nissan.it\") > -1){window.setTimeout(\"checkParent()\", 500);}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"<\/script>" +
	"<html>" +
	"<head>" +
	"<title>Nissan Sondaggio online</title>" +
	"<style>" +
	"#header_container {width: 100%; height: 75px; margin-top: 10px;}" +
	"#header_table {width: 100%; height: 75px;}" +
	"a:link, a:active, a:visited, a:hover{color: #093; text-decoration: underline;}" +
	"a:hover{text-decoration: none;}" +
	"</style>" +
	"</head>" +
	"<body>" +
	"<div id=\"header_container\">" +
	"<table id=\"header_table\" cellspacing=\"0\">" +
	"<tr>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"<td style=\"width: 15px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_left.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: auto; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg.gif') top left repeat-x;\"><div id=\"por-logo\"><img src=\"http://scripts.psyma.com/img/prc.gif\" alt=\"Psyma Research+Consulting Logo\"/></div></td>" +
	"<td style=\"width: 17px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_right.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"</tr>" +
	"</table>" +
	"</div>" +
	"<div style=\"padding: 0 7px 0 10px;\">" +
	"<p style=\"font-family: arial; font-size: 16px; font-weight: bold;\">Grazie per aver scelto di partecipare!</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">In questa finestra comparir&aacute; automaticamente il sondaggio online dopo la Sua visita al sito Nissan.</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">Continui per favore con la visita del sito e compili il questionario solo dopo aver terminato.</p>" +
	"<p style=\"font-size: 10px; font-family: arial;\">Nel caso il sondaggio non dovesse iniziare automaticamente dopo la Sua visita come sopra descritto, clicchi per favore <a href=\"javascript: openSurvey();\">qui</a>.</p>" +
	"</div>" +
	"</body>" +
	"</html>";
	
	domain_check_text['de'] = "window.setTimeout(\"checkParent()\", 500);" +
	"window.opener.focus();" +
	"function openSurvey(){document.location.href = psyma_popupURL;}" +
	"function checkParent(){" +
	"if(window.opener){" +
	"try{psyma_referrer = window.opener.location.href;}" +
	"catch(e){openSurvey();return;}" +
	"if(psyma_referrer.indexOf(\"nissan.de\") > -1){window.setTimeout(\"checkParent()\", 500);}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"<\/script>" +
	"<html>" +
	"<head>" +
	"<title>Nissan Online-Umfrage</title>" +
	"<style>" +
	"#header_container {width: 100%; height: 75px; margin-top: 10px;}" +
	"#header_table {width: 100%; height: 75px;}" +
	"a:link, a:active, a:visited, a:hover{color: #093; text-decoration: underline;}" +
	"a:hover{text-decoration: none;}" +
	"</style>" +
	"</head>" +
	"<body>" +
	"<div id=\"header_container\">" +
	"<table id=\"header_table\" cellspacing=\"0\">" +
	"<tr>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"<td style=\"width: 15px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_left.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: auto; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg.gif') top left repeat-x;\"><div id=\"por-logo\"><img src=\"http://scripts.psyma.com/img/prc.gif\" alt=\"Psyma Research+Consulting Logo\"/></div></td>" +
	"<td style=\"width: 17px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_right.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"</tr>" +
	"</table>" +
	"</div>" +
	"<div style=\"padding: 0 7px 0 10px;\">" +
	"<p style=\"font-family: arial; font-size: 16px; font-weight: bold;\">Herzlichen Dank f&uuml;r Ihre Teilnahmebereitschaft!</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">In diesem Fenster wird nach Ihrem Besuch der Nissan-Webseite die Umfrage automatisch gestartet.</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">Bitte surfen Sie ruhig weiter und beantworten Sie die Umfrage erst nach Ihrem Besuch der Website. </p>" +
	"<p style=\"font-size: 10px; font-family: arial;\">Sollte die Umfrage <u>nach Ihrem Besuch</u> nicht wie oben beschrieben automatisch starten, klicken Sie bitte <a href=\"javascript: openSurvey();\">hier</a>.</p>" +
	"</div>" +
	"</body>" +
	"</html>";
	
	domain_check_text['se'] = "window.setTimeout(\"checkParent()\", 500);" +
	"window.opener.focus();" +
	"function openSurvey(){document.location.href = psyma_popupURL;}" +
	"function checkParent(){" +
	"if(window.opener){" +
	"try{psyma_referrer = window.opener.location.href;}" +
	"catch(e){openSurvey();return;}" +
	"if(psyma_referrer.indexOf(\"nissan.de\") > -1){window.setTimeout(\"checkParent()\", 500);}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"<\/script>" +
	"<html>" +
	"<head>" +
	"<title>Nissan online survey</title>" +
	"<style>" +
	"#header_container {width: 100%; height: 75px; margin-top: 10px;}" +
	"#header_table {width: 100%; height: 75px;}" +
	"a:link, a:active, a:visited, a:hover{color: #093; text-decoration: underline;}" +
	"a:hover{text-decoration: none;}" +
	"</style>" +
	"</head>" +
	"<body>" +
	"<div id=\"header_container\">" +
	"<table id=\"header_table\" cellspacing=\"0\">" +
	"<tr>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"<td style=\"width: 15px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_left.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: auto; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg.gif') top left repeat-x;\"><div id=\"por-logo\"><img src=\"http://scripts.psyma.com/img/prc.gif\" alt=\"Psyma Research+Consulting Logo\"/></div></td>" +
	"<td style=\"width: 17px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_right.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"</tr>" +
	"</table>" +
	"</div>" +
	"<div style=\"padding: 0 7px 0 10px;\">" +
	"<p style=\"font-family: arial; font-size: 16px; font-weight: bold;\">Tack for din villighet att delta!</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">I undersökning kommer att starta i detta fönster, efter ditt besök på Nissan webbplats.</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">Vänligen fortsätt ditt besök på webbplatsen och fyll endast i frågeformuläret efter det att du avslutat ditt besök.</p>" +
	"<p style=\"font-size: 10px; font-family: arial;\">I händelse att undersökningen inte startar automatiskt <u>efter ditt besök på hemsidan</u>, i enlighet med vad som beskrivits ovan, var vänlig och klicka<a href=\"javascript: openSurvey();\">här</a>.</p>" +
	"</div>" +
	"</body>" +
	"</html>";

	domain_check_text['ru'] = "window.setTimeout(\"checkParent()\", 500);" +
	"window.opener.focus();" +
	"function openSurvey(){document.location.href = psyma_popupURL;}" +
	"function checkParent(){" +
	"if(window.opener){" +
	"try{psyma_referrer = window.opener.location.href;}" +
	"catch(e){openSurvey();return;}" +
	"if(psyma_referrer.indexOf(\"nissan.ru\") > -1){window.setTimeout(\"checkParent()\", 500);}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"else{window.focus();openSurvey();}" +
	"}" +
	"<\/script>" +
	"<html>" +
	"<head>" +
	"<title>Nissan online survey</title>" +
	"<style>" +
	"#header_container {width: 100%; height: 75px; margin-top: 10px;}" +
	"#header_table {width: 100%; height: 75px;}" +
	"a:link, a:active, a:visited, a:hover{color: #093; text-decoration: underline;}" +
	"a:hover{text-decoration: none;}" +
	"</style>" +
	"</head>" +
	"<body>" +
	"<div id=\"header_container\">" +
	"<table id=\"header_table\" cellspacing=\"0\">" +
	"<tr>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"<td style=\"width: 15px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_left.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: auto; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg.gif') top left repeat-x;\"><div id=\"por-logo\"><img src=\"http://scripts.psyma.com/img/prc.gif\" alt=\"Psyma Research+Consulting Logo\"/></div></td>" +
	"<td style=\"width: 17px; background: #fff url('http://scripts.psyma.com/documents/popup_header_bg_right.gif') top left no-repeat;\"></td>" +
	"<td style=\"width: 1px;\">&nbsp;</td>" +
	"</tr>" +
	"</table>" +
	"</div>" +
	"<div style=\"padding: 0 7px 0 10px;\">" +
	"<p style=\"font-family: arial; font-size: 16px; font-weight: bold;\">Спасибо Вам большое за Вашу готовность принять участие! </p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">В этом окне начнется исследование после Вашего посещения веб-сайта Nissan.</p>" +
	"<p style=\"font-family: arial; font-size: 13px; font-weight: bold;\">Пожалуйста, продолжите Ваш визит на веб-сайте и заполните анкету только после завершения Вашего визита.</p>" +
	"<p style=\"font-size: 10px; font-family: arial;\">В случае, если исследование не начнется автоматически после Вашего посещения веб-сайта, как описанно выше, пожалуйта, щелкните <a href=\"javascript: openSurvey();\">сюда</a>.</p>" +
	"</div>" +
	"</body>" +
	"</html>";

	// open window 
	var survey_window = window.open('', '',  'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=470,height=300,top=0,left=0');
	if (survey_window)
	{
		survey_window.document.write('<script type="text/javascript"> var psyma_popupURL = "' + psymaPopupURL + '";');
		survey_window.document.write(domain_check_text[locale]);
	}
}

function psyma_wtp (locale)
{
	psyma_open_link(locale,"wtp");
}

function psyma_privacy (locale)
{
	psyma_open_link(locale,"privacy");	
}

function psyma_info (locale)
{
	psyma_open_link(locale,"info");
}

function psyma_open_link(locale, type) {
	var link = "";
	var dimensions = "width=500,height=350";	
	switch(type)
	{
		case "wtp":
			link = "wtp/wtp.php";
			dimensions = "width=500,height=350";
		break;
		case "privacy":
			link = "privacy/privacy.php";
			dimensions = "width=600,height=680";
		break;
		case "info":
			link = "por/por.php";
			dimensions = "width=500,height=480";
		break;
	}
	window.open(
		"http://scripts.psyma.com/documents/" + link + '?lang=' + locale, 
		'por_' + type, 
		'toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,' + dimensions + ',top=0,left=0');
}

function isPopinDisplayed(locale)
{
	if(psyma_samplingRate[locale] === undefined)
		return false;
	
	// check Cookie
	if(get_psyma_cookie(psyma_cookie_id))
		return false;
	
	// checkSampleRate
	var rndNumber = Math.round( 1 + 100 * (Math.random()) );   // Zufallzahl zwischen 0 und 100
	if (rndNumber > psyma_samplingRate[locale])
		return false;
	// if we survived this far, show layer and set cookie
	//set_psyma_cookie(psyma_cookie_id, 1, "/", "", "", "");
	set_psyma_cookie(psyma_cookie_id, 1, "/", "", "", psyma_cookie_exp);
	return true;
}

function getManifestURL(locale)
{
	var xmlLink = "http://scripts.psyma.com/xml/ab" + locale + "/nissan.xml";
 	return xmlLink;
}
