// different java-script functions used on different pages


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 checklogin()
{
if (document.loginform.username.value != "Benutzername")
{document.loginform.submit();
return false;
}
}

function partnerlogin() { //v1.2 by PVII
 var g,b,k,f,args=partnerlogin.arguments;
 var a = parseInt(args[0]);
 if(isNaN(a))a=0;
 if(!document.p7setc) {p7c=new Array();document.p7setc=true;
  for (var u=0;u<10;u++) {p7c[u] = new Array();}}
 for(k=0; k<p7c[a].length; k++) {
  if((g=MM_findObj(p7c[a][k]))!=null) {
   b=(document.layers)?g:g.style;b.visibility="hidden";}}
 for(k=1; k<args.length; k++) {
  if((g=MM_findObj(args[k])) != null) {
   b=(document.layers)?g:g.style;b.visibility="visible";f=false;
   for(j=0;j<p7c[a].length;j++) {
    if(args[k]==p7c[a][j]) {f=true;}}
  if(!f) {p7c[a][p7c[a].length++]=args[k];}}}
}


function blendOut() {
  document.getElementById("search").style.visibility='hidden';
}


function blend() {
  document.getElementById("logpartner").style.visibility='hidden';
}

function blendIn() {
  document.getElementById("logpartner").style.visibility='visible';
}



function onload1(){ 
partnersurvey = getCookie("partnersurvey");

  if (typeof partnersurvey == "undefined")
  {
  	setCookie('partnersurvey', 'firstvisit');
  	window.open ('/popup/timsurvey.htm', 'timsurveyconfirm', 'scrollbars=no,status=no,width=600,height=500');
  }
}

function onloadPSPSurvey(){ 
  window.open ('http://timsurvey.inmedias.de/scripts/index.cfm?fa=Pages.ShowPage&SurveyID=105&Position=-1', 'PSPSurvey', 'scrollbars=yes,status=no,width=650,height=700');
}


function unload() {
	
  var partnersurvey = getCookie("partnersurvey");
  if ((typeof partnersurvey == "undefined") || (partnersurvey != "showtimsurvey")) return true;
  
	setCookie('partnersurvey', 'timsurveyvisited');

	w=window.open("","aid_leave_site_check",'width=1,height=1,top=2500,left=2500,dependent=1,z-lock=1,alwaysLowered=1,');
 	if (navigator.userAgent.indexOf("MSIE") == -1)
	{
		w.document.write("<"+"script>\r\n");
		w.document.write("<!--\r\n");
		w.document.write("function check() {\r\n");
		w.document.write("alert(opener.location.href);\r\n");
		w.document.write("alert('www.netgear.de');\r\n");
		w.document.write("if (opener.closed || opener.location.href.indexOf('www.netgear.de/de/partner') == -1)\r\n");
		w.document.write("window.open('http://timsurvey.inmedias.de/scripts/index.cfm?fa=Pages.ShowPage&SurveyID=85&Position=-1','Survey85','status=no,scrollbars=no,width=600,height=500');\r\n");
		w.document.write("window.close();\r\n");
		w.document.write("}\r\n");
		w.document.write("setTimeout('check()',500);\r\n");
		w.document.write("//-->\r\n");
		w.document.write("</"+"script>\r\n");
	}
	else
	{
		w.document.write("<"+"script language='VBScript'>\r\n");
		w.document.write("<!--\r\n");
		w.document.write("sub check\r\n");
		w.document.write("on error resume next\r\n");
		w.document.write("if opener.closed or (InStr(opener.location.href,\"www.netgear.de/de/partner\") = 0 and InStr(opener.location.href,\"www.netgear.de/de/partner\") = 0)  then\r\n");
		w.document.write("window.open \"http://timsurvey.inmedias.de/scripts/index.cfm?fa=Pages.ShowPage&SurveyID=85&Position=-1\",\"Survey85\",\"status=no,scrollbars=no,width=600,height=500\"\r\n");
		w.document.write("end if\r\n");
		w.document.write("if Err.number<>0 then\r\n");
		w.document.write("window.open \"http://timsurvey.inmedias.de/scripts/index.cfm?fa=Pages.ShowPage&SurveyID=85&Position=-1\",\"Survey85\",\"status=no,scrollbars=no,width=600,height=500\"\r\n");
		w.document.write("Err.clear\r\n");
		w.document.write("end if\r\n");
		w.document.write("window.close\r\n");
		w.document.write("end sub\r\n");
		w.document.write("setTimeout \"check\",500\r\n");
		w.document.write("//-->\r\n");
		w.document.write("</"+"script>\r\n");
	}
	return true;
}

function CreateControl(DivID, CLSID, ObjectID,WIDTH, HEIGHT, URL, AUTOSTART)
{
  var d = document.getElementById(DivID);
  d.innerHTML = '<object classid=' + CLSID + ' id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT +'><param name="URL" value=' + URL + '><param name="autoStart" value=' + AUTOSTART + '/>';
}
