
function getAdvent(language,user,key,uniid) {
	var url = "http://dotadvent.ch/index.php?pw="+uniid+"&language="+language+"&lang="+language+"&username="+user+"&key="+key+"&true";
	window.open(url,"viewformat","width=1100px,height=800px,left=100,top=200,resizable=yes,status=yes,scrollbars=yes");
}
function Adventviewsogehtes(url) {
	window.open(url,"sogehts","width=998px,height=500px,left=100,top=100,resizable=no,status=yes,scrollbars=yes");
}

/**
jQuery(document).ready(function($) {
	$('a[rel*=facebox]').facebox();
	$('a[target*=_facebox]').facebox();
});
**/


if(typeof(UserLocale) == "undefined" ){
	UserLocale ='';
}

/**
if( UserLocale == "de_CH" ) {
	document.write('<script src="https://4qinvite.4q.iperceptions.com/1.aspx?sdfc=8064376a-1843-0b6d35da-18d8-4b9a-abc7-c46787797aed&lID=5&loc=4Q-WEB1" type="text/javascript" defer="defer" ></script>');		
}
**/


function viewImageECG(image,id,secure,lang) {
	var url = "http://portlets.univadis.ch/_popups/ECG_imgVorschau.php?image="+image+"&id="+id+"&secure="+secure+"&true";
	window.open(url,"viewimage","width=700px,height=550px,left=100,top=100,resizable=no,status=1,scrollbars=0");
}



//begin form-proxy
var ds_testNr = 0;
var ds_waitTheEnd = window.setInterval( function (){
									ds_testNr++;
									if(typeof strMsg != "undefined"){ 
										clearInterval(ds_waitTheEnd);
										if(document.getElementById('stat')!=null){ document.getElementById('stat').innerHTML='got '+ds_testNr;}
											//ds_init();
									}else{
										if(ds_testNr>150){clearInterval(ds_waitTheEnd);}
										if(document.getElementById('stat')){ document.getElementById('stat').innerHTML=ds_testNr;}
									}
								},200);

if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", ds_init, false);
}
// for Internet Explorer (using conditional comments)
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
    if (this.readyState == "complete") {
        ds_init(); // call the onload handler
    }
};
/*@end @*/


function ds_init(){
	// Versuch von Adi 01.05.2008
	if(undefined != window.PageName){
		var PageName = "Dotspot"; 
	}else{
//	if(( PageName != 'Edit_Profile')&&( PageName != 'ChangePassword') ){ return true; }
	if(( PageName != 'ChangePassword') ){ return true; }
	
//	if((UserName == 'test_dech') || (UserName == 'test_frch')){
//	if( (UserName == 'test_frch')){
		ds_dotIni();
//	}
	}
}

function ds_dotIni(){
//	return true;
	newAction = 'http://tools2.univadis.ch/opentst/proxy.php';
	if(typeof en_proxyUri != "undefined"){newAction = en_proxyUri;}
	
	foundForms = 0
	for(m=0;m<document.forms.length;m++)
	{

		theForm = document.forms[m];
		statId = 'stat';
		if(document.getElementById){
			var stat = document.getElementById(statId);
		}else if(document.all){
			var stat = document.all[statId];
		}else{
			var stat = null;
		}
	
		//only do password check at the moment
		var doit = false;
		doit = doit||((theForm.module.value == "com.med.phd.UserRegistrationModule")&&(theForm.action.value == "savePassword"));
		doit = doit||((theForm.module.value == "com.med.phd.tibco.TibcoUserRegistrationModule")&&(theForm.action.value == "savePersonalInfo"));
	
		if(doit)
		{
			
			//	alert('doc.forms.nodeName='+theForm.attributes[0].nodeName+' doc.forms.nodeValue='+theForm.attributes[0].nodeValue);
			var formObj = null;
			for (n=0;n<theForm.attributes.length;n++)
					{
						if (theForm.attributes[n].nodeName == 'action')
						{
							oldAction = theForm.attributes[n].nodeValue;
							theForm.attributes[n].nodeValue = newAction;
							formObj = theForm.attributes[n];
						}
					}
	
			originSrv="";
			originSrv= document.location.protocol+"//"+document.location.host;
			//originSrv = 'http://uat-bi.univadis.com';
	
			oldAction = originSrv + oldAction;
			
		//	alert('doc.forms.nodeName='+formObj.nodeName+' doc.forms.nodeValue='+formObj.nodeValue);
		
			//generate hidden field
			newone = document.createElement("input");
			newone.setAttribute("type","hidden");
			newone.setAttribute("name","en_prx_target");
			newone.setAttribute("value",oldAction);
			theForm.appendChild(newone);
		
			newone2 = document.createElement("input");
			newone2.setAttribute("type","hidden");
			newone2.setAttribute("name","en_prx_user");
			newone2.setAttribute("value",UserName);
			theForm.appendChild(newone2);

			newone3 = document.createElement("input");
			newone3.setAttribute("type","hidden");
			newone3.setAttribute("name","en_prx_PageName");
			newone3.setAttribute("value",PageName);
			theForm.appendChild(newone3);

		
			if(stat){
				stat.innerHTML += "<br>new action="+formObj.nodeValue;
		//		stat.innerHTML = 'Test';
			}
			foundForms++;
	
		} //end doit

	} //end go trough all forms

// Alert, if proxy activated
//	if (foundForms > 0) { alert('proxy activated for '+ foundForms +' forms') };

	return true;
}

//end form-proxy


function urlCo(variable){
	variable=escape(variable);
	return variable;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}





function goToCatalogueCenter(lang,user,secure,key) {
	var url = "http://portlets.univadis.ch/_popups/praemien_catalog.php?portaluser="+user+"&language="+lang+"&secure="+secure+"&key="+key+"&true";
	window.open(url,"Catalogue","width=740px,height=499px,left=100,top=200,resizable=yes,status=1,scrollbars=1");
}
function goToCatalogueCenter2(lang,user,secure,key) {
	var url = "http://portlets.univadis.ch/_popups/praemien_catalog.php?portaluser="+user+"&language="+lang+"&secure="+secure+"&key="+key+"&true";
	window.open(url,"Catalogue","width=978px,height=699px,left=150,top=200,resizable=yes,status=1,scrollbars=1,toolbar=no,menubar=yes,location=no");
}


function viewImagesShop(image,phath,secure) {
	var url = "http://portlets.univadis.ch/_popups/popupPhotos.php?image="+image+"&phath="+phath+"&secure="+secure+"&true";
	window.open(url,"viewimage","width=496px,height=400px,left=100,top=200,resizable=no,status=1,scrollbars=0");
}

function viewImagesTTB(image,phath,secure) {
	var url = "http://portlets.univadis.ch/_popups/popupPhotos.php?image="+image+"&phath="+phath+"&secure="+secure+"&true";
	window.open(url,"viewimage","width=496px,height=400px,left=100,top=200,resizable=no,status=1,scrollbars=0");
}


function viewMovie(secure,language) {
	var url = "http://portlets.univadis.ch/_popups/popupMovies.php?language="+language+"&secure="+secure+"&true";
	window.open(url,"viewimage","width=496px,height=400px,left=100,top=200,resizable=no,status=1,scrollbars=0");
}
function viewNewsletter(url,language) {
	window.open(url,"viewimage","width=650px,height=650px,left=100,top=200,resizable=yes,status=yes,scrollbars=yes");
}

function viewNLFormate(language) {
	var url = "http://portlets.univadis.ch/_popups/popupEmailFormate.php?language="+language+"&lang="+language+"&true";
	window.open(url,"viewformat","width=513px,height=670px,left=100,top=200,resizable=yes,status=yes,scrollbars=yes");
}



function viewUmfrage(language) {
	var urlde = "http://www.mercksurveys.com/emea/univadis/univadissurveychde.htm?@@SUBSCCNR@@";
	var urlfr = "http://www.mercksurveys.com/emea/univadis/univadissurveychfr.htm?@@SUBSCCNR@@";
	if( language == "fr" ) {
		url = urlfr;
	}else{
		url = urlde;
	}
	window.open(url,"viewformat","width=640px,height=600px,left=100,top=200,resizable=yes,status=yes,scrollbars=yes");
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/**
document.write('<script type="text/javascript" src="http://www.tapefailure.com/track/ca48104fed8a78d41c19c24087ba70fd/1/"></script>');
document.write('<script type="text/javascript">var tfForms = true;</script>');
**/
