// REMOVE THE FOCUS OF THE LINKS -------------------------------------

function removeFocus () {
	// Remove links Focus 
	for(i=0;i<document.links.length;i++) {
		document.links[i].onfocus=function() {if(this.blur)this.blur()}; 
	}	
}

// OPEN A POPUP -------------------------------------------------------

if (is.mac) { var offsetMac = 0; } else { var offsetMac = 0; }

function pop(goPage,nom,windowWidth,windowHeight,style) {
	var x = 0;
	var y = 0;
	var offset = 30;
	var popped;
		
	if (screen) x = (screen.availWidth - windowWidth) / 2;
	if (screen) y = (screen.availHeight - windowHeight) / 2;
	
	
	if ( style == 'POP' ) { 
	    var popped = window.open(goPage,nom,'width='+windowWidth+',height='+(windowHeight+offsetMac)+',status=no,menubar=no,scrollbars=no,resizable=no,screenX='+x+',screenY='+y+',left='+x+',top='+y); 
    }
    
	if ( style == 'POPSCROLL' ) { 
	    var popped = window.open(goPage,nom,'width='+windowWidth+',height='+(windowHeight+offsetMac)+',status=no,menubar=no,scrollbars=yes,resizable=no,screenX='+x+',screenY='+y+',left='+x+',top='+y); 
    }

	if ( style == 'WINDOW' ) {
		if (windowHeight > screen.availHeight) windowHeight = (screen.availHeight - offset);
		var popped = window.open(goPage,nom,'width='+windowWidth+',height='+(windowHeight+offsetMac)+',status=yes,menubar=yes,scrollbars=yes,resizable=yes,screenX='+x+',screenY='+y+',left='+x+',top='+y);
	}
	
	if ( is.ns || document.all) popped.focus();
	if ( !popped.opener) { popped.opener = window; }
}


function showHideSwitch (theid, lnk) {
    if (document.getElementById) {
        var switch_id = document.getElementById(theid);

        if (switch_id.className == "logo showSwitch") {
            // collapse
            switch_id.className = 'logo hideSwitch';
            lnk.innerHTML = "expand header";


            var today = new Date();
            expires = 365 * 1000 * 60 * 60 * 24;
            var expires_date = new Date( today.getTime() + (expires) );
            document.cookie = theid+'=hideSwitch'+'; path=/' + ";expires=" + expires_date.toGMTString();
        } else { 
            // expand
            switch_id.className = 'logo showSwitch';
            lnk.innerHTML = "collapse header";

            var today = new Date();
            expires = 365 * 1000 * 60 * 60 * 24;
            var expires_date = new Date( today.getTime() + (expires) );
            document.cookie = theid+'=showSwitch'+'; path=/' + ";expires=" + expires_date.toGMTString();

        }
    }
}

function InfoHideSwitch (box, button) {
    if (document.getElementById) {
        var box_id = document.getElementById(box);
				var button_id = document.getElementById(button);

        if (box_id.className == "show") {
            // collapse
            box_id.className = 'hide';
						button_id.className = '';
        } else { 
            // expand
            box_id.className = 'show';
						button_id.className = 'on';
						scrollToBottom();
        }
    }
}

function scrollToBottom () {
	window.scrollTo(0,5000);
}

function hideFlash(theid) {
	if (document.getElementById) {
      var notice_id = document.getElementById(theid);
			notice_id.className = 'hide';
  }
}
