var agent = navigator.userAgent;

function OpenSite(myskin, sessionid, delay) {
  if (myskin=="")       myskin      = 1;
  else                  ppidquery   = "";
  url = 'uwphome.php?myskin=' + myskin + '&SID=' + sessionid;
  wname = "UWPHomeWin" + myskin;
  var delay = delay * 1;
  window.setTimeout("wname=window.open(url,wname,'resizable=1,scrollbars=1,toolbar=0,location=0,menubar=0,status=1');wname.focus();", delay);
}

function ArtistWin(url) {
  var width  = 1000;
  var height = 720;
  var wname = "ttExtraWin" + url;
  url   = "../artist_"+url;
  MyWindow=window.open(url,wname,'resizable=1,scrollbars=1,toolbar=0,location=0,menubar=0,status=1,left=0,top=0,width='+width+',height='+height);
  if (agent.indexOf("MSIE") == -1) MyWindow.focus();
}

function ExtraWin(url,width,height) {
  if (width=="")  width  = 700;
  if (height=="") height = 600;

  var wname = "ttExtraWin";
  MyWindow=window.open(url,wname,'resizable=1,scrollbars=1,toolbar=0,location=0,menubar=0,status=1,left=0,top=0,width='+width+',height='+height);
  if (agent.indexOf("MSIE") == -1) MyWindow.focus();

  //wname = "ttExtraWin" + url;
  //wname=window.open(url,wname,'resizable=1,scrollbars=1,toolbar=0,location=0,menubar=0,status=1,left=0,top=0,width='+width+',height='+height);
  //wname.focus();
}

function OpenPlayerPopUp(myskin, sessionid, ppid) {
  if (myskin=="")       myskin      = 1;
  if (ppid!=undefined)  ppidquery   = "&ppid="+ppid;
  else                  ppidquery   = "";
  var url = 'uwphome_p.php?myskin=' + myskin + '&SID=' + sessionid + ppidquery;
  var wname = "UWPPlayerWin" + myskin;
  MyWindow=window.open(url,wname,'resizable=0,scrollbars=0,toolbar=0,location=0,menubar=0,status=1,width=435,height=380,top=0,left=0,screenX=0,screenY=0');
  if (agent.indexOf("MSIE") == -1) MyWindow.focus();
}

function ReOpenMainSite(url) {
  if (opener && !opener.closed) {
	  opener.focus();	
    this.close();
  }
	else {
    MainSite=window.open(url);
    MainSite.focus();
  }
}

function maxWindow(width,height,position) {	
  if (position == "center") {
    intAnchoScreen = screen.availWidth;
    intAltoScreen  = screen.availHeight;
    posX   = (intAnchoScreen - width) / 2;
    posY   = (intAltoScreen - height) / 2;
    window.moveTo(posX,posY);

    //alert("width, height: "+width+", "+height);
    //alert("posX, posY: "+posX+", "+posY);
  }
  else window.moveTo(1,1);

  if (document.all)  {
    top.window.resizeTo(width,height);
  }
  else if (document.layers||document.getElementById) {
    if (top.window.outerHeight<height||top.window.outerWidth<width) {
      top.window.outerHeight = height;
      top.window.outerWidth = width;
    }
  }
}

function Resize(width,height,position) {
  if (position != "center") window.moveTo(1,1);
  intAnchoScreen = screen.availWidth;
  intAltoScreen  = screen.availHeight;
  posX   = (intAnchoScreen - width) / 2;
  posY   = (intAltoScreen - height) / 2;
  window.moveTo(posX,posY);

  window.resizeTo(width,height);
}


function InitWindow(agent,mode,width,height) {
  if (mode=="") mode = "center";

  if (mode=="fullscreen") {
    width  = screen.availWidth;
    height = screen.availHeight;
  }
  else if (width == "" || height == "") {
    width  = 620;
    height = 780;
  }

  if (agent=="MSIE")   window.setTimeout("maxWindow('"+width+"','"+height+"','"+mode+"')", 100);
  else                 window.setTimeout("Resize('"+width+"','"+height+"','"+mode+"')", 100);
}


function ChangeStyle(elem,what,value) {
  document.getElementById("skinchoice").style.visibility = value;
}


function ShowWEBPODX(mode,ppid,plid,pro_ser,pro_id,boxmode) {

	if (document.getElementById("WEBPODX")) {
		if (mode=="show") {

      if (!boxmode) boxmode = "show";

      document.getElementById("WEBPODX").style.visibility = "visible";
      document.getElementById("WEBPODX").style.display    = "block";
      var so = new SWFObject("../webpodx/webpodx.swf", "webpodxmovie", "640", "378", "10", "#000000");
      so.addParam("quality", "high");
      //so.addParam("menu", "false");
      so.addParam("scale", "noscale");
      so.addParam("allowfullscreen", "true");
      so.addParam("allowScriptAccess", "always");
      so.addParam("wmode", "transparent");
      so.addVariable("pro_ser", pro_ser);
      so.addVariable("ppid", ppid);
      so.addVariable("pro_id", pro_id);
      so.addVariable("plid", plid);
      so.addVariable("myskin", "1");
      so.addVariable("pathlevel", "../");
      so.addVariable("wpx_path", "webpodx/");
	    so.addVariable("contentpath", "webpodx");
      so.addVariable("skinAlpha", "0.0");
      so.addVariable("skinColor", "0x000000");
      so.addVariable("volume", "0.7");
      so.addVariable("boxmode", boxmode);
      so.write("WEBPODX");
    }
		else {
			if (document.getElementById("WEBPODX")) {
        document.getElementById("WEBPODX").style.visibility = "hidden";
        document.getElementById("WEBPODX").style.display    = "none";
			}
    }
	}
}


function ShowHide(showid, hideid) {
  if (document.getElementById(showid)) document.getElementById(showid).style.display = '';
  if (document.getElementById(hideid)) document.getElementById(hideid).style.display = 'none';
}

function SendMailTo(email, subject, id) {
  alert(email);
  alert(subject);
  alert(id);
  //this.location.href = 'mailto:e@e.de';
}

