function rolloverImg(id,src) {
	doc=document;
  el=doc.getElementById(id);
  if(!el.oldSrc) el.oldSrc=el.src;
  el.src=src;
  doc.currentHover=id;
}
function restoreImg() {
	doc=document;
  id=doc.currentHover;
  el=doc.getElementById(id);
  el.src=el.oldSrc;
}
function check_email(str) {
at=str.indexOf('@');
dot=str.indexOf('.',at);
last_at=str.lastIndexOf('@');
last_dot=str.lastIndexOf('.');
if(at>0 && dot>0 && (dot-at)>1 && str.length-dot>1 && last_dot==dot && last_at==at && str.length>5 && str.indexOf(' ')<1) { valid='1' }
else { valid='0'; }
return valid
}
function show_and_hide(id1,id2) {
	document.getElementById(id1).style.display='block';
	document.getElementById(id2).style.display='none';
}
function pop_up(url,name,width,height) {  
	w = (document.body.clientWidth - width)/2;
  h = (document.body.clientHeight)/2;
	window.open(url,name,'width=' + width + ',height=' + height + ',menubar=no,left='+w+',top='+h+',screenX='+w+',screenY='+h+'');
}
function write_editor(text_to_write) {
	parent.frame_editor.document.write(text_to_write);
}
function show_hide(id) {
	if(document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'block'; }
	else { document.getElementById(id).style.display = 'none'; }
}
function show_hide_check(id) {
	
	alert('You must login to add a review.');
	}
function increase_height(id) {
	var h = parseInt(document.getElementById(id).style.height);
	var h = h + 50;
	document.getElementById(id).style.height = h + 'px';
}
function decrease_height(id) {
	var h = parseInt(document.getElementById(id).style.height);
	if(h > 50) {
	var h = h - 50;
	document.getElementById(id).style.height = h + 'px';
	}
	else {
		alert('Minimum height reached');
	}
}
function add_emot(id_t,emot) {
	document.getElementById(id_t).value = document.getElementById(id_t).value + emot;
	document.getElementById(id_t).focus();
}
function over(id,color) {
	document.getElementById(id).style.backgroundColor = "#" + color;
}
function out(id) {
	document.getElementById(id).style.backgroundColor = '';
}
function over_u(id) {
	document.getElementById('usermenu' + id).style.backgroundColor = "#83c274";
	document.getElementById('usermenu' + id).style.padding = "2";
	document.getElementById('userlink' + id).style.color="#ffffff";
	document.getElementById('userlink' + id).style.fontWeight="bold";
}
function out_u(id) {
	document.getElementById('usermenu' + id).style.backgroundColor = "";
	document.getElementById('usermenu' + id).style.padding = "2";
	document.getElementById('userlink' + id).style.color="#000000";
	document.getElementById('userlink' + id).style.fontWeight="normal";
}
function show(id) {
	document.getElementById(id).style.display='block';
}
function hide(id) {
	document.getElementById(id).style.display='none';
}
function click_search(s_element) {
	if(s_element == 'all') {
	document.getElementById('quizz').value='yes';
	document.getElementById('shopping').value='yes';
	document.getElementById('answers').value='yes';
	document.getElementById('tips').value='yes';
	document.getElementById('my_looks').value='yes';
	}
	else {
	document.getElementById('quizz').value='';
	document.getElementById('shopping').value='';
	document.getElementById('answers').value='';
	document.getElementById('tips').value='';
	document.getElementById('my_looks').value='';
	
	document.getElementById(s_element).value='yes';
	}
}
function browser_detection() {
	browser_version = parseInt(navigator.appVersion);
	browser_type = navigator.appName;
	if (browser_type == "Microsoft Internet Explorer" && (browser_version >= 4)) {
   var type='ie';
	} 
	else {
   var type='other';
	}
	return type;
}
function hover_star(nr,star) {
	for(i=1;i<=nr;i++) {
  	document.getElementById("star"+i).src='/icons/'+star+'_hover.gif';
  }
}
function out_star(nr,star) {
	for(i=1;i<=nr;i++) {
  	tp=document.getElementById('star'+i).name;
  	document.getElementById("star"+i).src='/icons/'+star+'_'+tp+'.gif';
  }
}
function search_type(type) {
	types = new Array('web','encyclopedia','store','all','videos');
  for(i=0;i<types.length;i++) {
		document.getElementById('search_'+types[i]).style.cursor='pointer';
		document.getElementById('search_'+types[i]).style.fontWeight='';
		document.getElementById('search_'+types[i]).onClick='search_type("'+types[i]+'")';
  }  
	document.getElementById('search_'+type).style.cursor='';
	document.getElementById('search_'+type).style.fontWeight='bold';
	document.getElementById('search_'+type).onClick='';
  
  document.getElementById('search_type').value=type;
}
function check_search() {
	if(document.getElementById('search_type').value=='web') {
  	document.getElementById('search_form').target='_blank';
  }
  else {
  	document.getElementById('search_form').target='';
  }
	el=document.getElementById('search_keyword');
	if(el.value.length<3) {
  	alert('Your keyword has to be at least 3 characters');
    el.focus();
    return false;
  }
}
function preload_images(folder,pics) {
	pics=pics.split(";");
  for(i=0;i<pics.length;i++) {
  	img=new Image();
    img.src=folder+pics[i];
  }
}
function changeValue(id) {
	d=document; el=d.getElementById(id);
	if(!el.oldValue) {
  	el.oldValue=el.value;
  }
  val=el.oldValue;
  if(el.value==el.oldValue) {
    el.focus();
  	el.value='';
    el.onblur=function() { returnValue(id) };
  }
}
function returnValue(id) {
	d=document; el=d.getElementById(id);
  if(el.value=='') el.value=el.oldValue;
}

// ---------- transparent png's for ie correction ----------

if(navigator.appVersion.indexOf("MSIE")!==-1) {
  function correctPNG()
  {
     var arVersion = navigator.appVersion.split("MSIE")
     var version = parseFloat(arVersion[1])
     if ((version >= 5.5) && (document.body.filters)) 
     {
        for(var i=0; i<document.images.length; i++)
        {
           var img = document.images[i]
           var imgName = img.src.toUpperCase()
           if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
           {
              var imgID = (img.id) ? "id='" + img.id + "' " : ""
              var imgClass = (img.className) ? "class='" + img.className + "' " : ""
              var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
              var imgStyle = "display:inline-block;" + img.style.cssText 
              if (img.align == "left") imgStyle = "float:left;" + imgStyle
              if (img.align == "right") imgStyle = "float:right;" + imgStyle
              if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
              var strNewHTML = "<span " + imgID + imgClass + imgTitle
              + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
              + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
              + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
              img.outerHTML = strNewHTML
              i = i-1
           }
        }
     }    
  }
  window.attachEvent("onload", correctPNG);
}
// ---------- end transparent png's for ie correction ----------

// <div style='overflow:hidden;height:0px;width:0px;'><iframe id='hiddenIfr' style='overflow:hidden;height:0px;width:0px;'></iframe></div>
function runFile(file) {
	d=document;
  ifr=d.getElementById('hiddenIfr');
  ifr.src=file;
}
function getElementPosition(elemID){
  var offsetTrail = document.getElementById(elemID);
  var offsetLeft = 0;
  var offsetTop = 0;
  while (offsetTrail){
   offsetLeft += offsetTrail.offsetLeft;
   offsetTop += offsetTrail.offsetTop;
   offsetTrail = offsetTrail.offsetParent;
  }
  if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined'){
   offsetLeft += document.body.leftMargin;
   offsetTop += document.body.topMargin;
  }
  return {left:offsetLeft,top:offsetTop};
}