/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function login(showhide){
    if(showhide == "show"){
        document.getElementById('popupbox').style.visibility="visible"; /* If the function is called with the variable 'show', show the login box */
    }else if(showhide == "hide"){
        document.getElementById('popupbox').style.visibility="hidden"; /* If the function is called with the variable 'hide', hide the login box */
    }
  }

// store current url in cookies
    function writeCookie(name, value, days){
    if(days){
        (time = new Date()).setTime(new Date().getTime()+days*24*60*60*1000);
        var exp = '; expires='+time.toGMTString();
    }else{
        var exp='';
    }
    document.cookie=name+"="+value+exp+"; path=/";
    return;
}

function readCookie(name){
    var cookies = document.cookie.split(';');
    for(var i=0; i<cookies.length; i++){
        var cookie=cookies[i].replace(/^\s+/, '');
        if (cookie.indexOf(name+'=')==0) return cookie.substring(name.length+1);
    }
    return null;
}

function eraseCookie(name){
    writeCookie(name, "", -1);
}

function addToCounter(){
eraseCookie('myCounter');
		var pageurl= document.location.href;
    writeCookie('myCounter', pageurl, 1);
    //alert(readCookie('myCounter'));
}

function addColorBox(sTarget, sURL, iWidth, iHeight) {
  jQuery(document).ready(function() {
    //console.log(sTarget);
    $j = jQuery.noConflict();
    $j(sTarget).colorbox({iframe:true, href:sURL,
      width: iWidth, height: iHeight});
  });
}
