/*
##############################################################################
# UCC User Created Content Version
# 2007-2010 (c) J3S GmbH, info@j3s.de
##############################################################################
# copying prohibited, do not use without written permission of J3S GmbH
##############################################################################
*/

function lite(o) {o.style.backgroundColor = '#dAe4eC'; o.style.cursor='hand';o.style.cursor='pointer';}
function dark(o) {o.style.backgroundColor = '';}

function openlink(link, name, width, height,toolbar) {
 if (typeof (name)   =='undefined') { name='popup';}
 if (typeof (width)  =='undefined') { width=800;}
 if (typeof (height) =='undefined') { height=600;}

 // pass additional hoverwidth information =)
 if(typeof(current_hover_width) != 'undefined' && current_hover_width != -1) {
   var hoverwidth= current_hover_width;
   link+= "&hoverwidth="+hoverwidth;
 }
 if (typeof (toolbar)=='undefined') { toolbar='status=yes,scrollbars=yes,resizable=yes,width='+width+',height='+height;}
 var posx= Math.round((screen.availWidth -width )/2);
 var posy= Math.round((screen.availHeight-height)/2);
 toolbar += ",left="+posx+",top="+posy;
 var popup = window.open(link,name,toolbar);
 popup.focus();
 return false;
}

function Demystify(data) {
  var chars=data.split(",");
  for (var c in chars){
    document.write(String.fromCharCode(chars[c]-37));
  }
}

/*****************************************************************************
 * getHeight
 * retrieves inner height of the body
 ****************************************************************************/

function getHeight() {
  var y;
  if (self.innerHeight) // all except Explorer
  {
  	y = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
  	// Explorer 6 Strict Mode
  {
  	y = document.documentElement.clientHeight;
  }
  else if (document.body) // other Explorers
  {
  	y = document.body.clientHeight;
  }
  return y;
}

/*****************************************************************************
 * getWidth
 * retrieves inner width of the body
 ****************************************************************************/

function getWidth() {
  var x;
  if (self.innerHeight) // all except Explorer
  {
  	y = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
  	// Explorer 6 Strict Mode
  {
  	x = document.documentElement.clientWidth;
  }
  else if (document.body) // other Explorers
  {
  	x = document.body.clientWidth;
  }
  return x;
}

/*****************************************************************************
 * getScrollX
 * retrieves x scroll position
 ****************************************************************************/

function getScrollX() {
  var x;
  if (self.pageXOffset) // all except Explorer
  {
  	x = self.pageXOffset;
  }
  else if (document.documentElement && document.documentElement.scrollLeft)
  	// Explorer 6 Strict
  {
  	x = document.documentElement.scrollLeft;
  }
  else if (document.body) // all other Explorers
  {
  	x = document.body.scrollLeft;
  }
  return x;
}

/*****************************************************************************
 * getScrollY
 * retrieves y scroll position
 ****************************************************************************/

function getScrollY() {
  var y;
  if (self.pageYOffset) // all except Explorer
  {
  	y = self.pageYOffset;
  }
  else if (document.documentElement && document.documentElement.scrollTop)
  	// Explorer 6 Strict
  {
  	y = document.documentElement.scrollTop;
  }
  else if (document.body) // all other Explorers
  {
  	y = document.body.scrollTop;
  }
  return y;
}

/*****************************************************************************
 * getx
 * retrieves x position of element specified by id
 * NOTE: the object has to be rendered *before* this function is called
 *
 * Parameters
 *   id:     id of object
 *
 * returns x position
 ****************************************************************************/

function getx(imgID,node) {
 var tempEl;
  if (imgID!='') tempEl = document.getElementById(imgID);
  else           tempEl = node;

  var xPos = tempEl.offsetLeft;
  tempEl = tempEl.offsetParent;
  while (tempEl != null) {
    xPos += tempEl.offsetLeft;
    tempEl = tempEl.offsetParent;
  }
  return xPos;
}

/*****************************************************************************
 * gety
 * retrieves y position of element specified by id
 * NOTE: the object has to be rendered *before* this function is called
 *
 * Parameters
 *   id:     id of object
 *
 * returns y position
 ****************************************************************************/

function gety(imgID,node) {
  var tempEl;
  if (imgID!='') tempEl = document.getElementById(imgID);
  else           tempEl = node;

  var yPos = tempEl.offsetTop;
  tempEl = tempEl.offsetParent;
  while (tempEl != null) {
    yPos += tempEl.offsetTop;
    tempEl = tempEl.offsetParent;
  }
  return yPos;
}

/**********************************************************************************
 * RandomParameter
 * creates a random parameter to force relad of pages.. sigh =(
 *********************************************************************************/

 function RandomParameter() {
   var d=new Date();
   var res = 'rnd='+d.getDate()+d.getMonth()+d.getYear()+d.getHours()+d.getMinutes()+d.getSeconds()+d.getMilliseconds()+Math.random()*10000000;
   res = res.replace('.','');
   return res;
 }

 /**********************************************************************************
 * AddRandomParameter
 * creates a random parameter to force relad of pages.. sigh =(
 *********************************************************************************/

 function AddRandom(url) {
   url = url.replace(/rnd=\d+/,'');
   if (url.indexOf('?') == -1) url+= '?';
   url+= "&"+RandomParameter();
   url = url.replace('?&','?');

   return url;
 }



/*****************************************************************************
 * GetXMLHttp
 * returns xhmtl object 
 ****************************************************************************/

function GetXMLHttp() {
  var xmlHttp = null;
  if (typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
  }
  if (!xmlHttp) {
    try {        xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch(e) {
      try {      xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch(e) { xmlHttp  = null; }
    }
  }
  return xmlHttp;
}

/*****************************************************************************
 * flip
 * flips state of item in detail view
 ****************************************************************************/

function flip(which){
var undefined;
if (document.getElementById(which) == undefined) return;
if (document.getElementById(which).style.display == 'none')
  document.getElementById(which).style.display = 'block';
else document.getElementById(which).style.display = 'none';
}

/*****************************************************************************
 * countpic
 * counts view/click on panoramio pic
 ****************************************************************************/

function countpic(p){
  var xml = GetXMLHttp();
  var url = AddRandom('/cgi-bin/rev%2epl?template=ecamp/w2/panoramio.htm&amp;id=' + p);
  
  xml.open('GET', url, true);
  xml.onreadystatechange = function () {
    if (xml.readyState == 4) {
      //alert(xml.responseText);
    }
  }
  xml.send(null);
}


