function setElemenhoverBuble (id, id2) {
	if (document.getElementById(id).className != "active") {
		document.getElementById(id).style.color = "#000000";
		document.getElementById(id2).style.color = "#106A8D";
	}
}
function disableElemenhoverBuble (id, id2) {
	if (document.getElementById(id).className != "active") {
		document.getElementById(id).style.color = "#7C796A";
		document.getElementById(id2).style.color = "#A4C4D1";
	}
}
function viewLogo(){
	document.getElementById('divLogoOver').style.display='block';
}
function unviewLogo(){
	document.getElementById('divLogoOver').style.display='none';
}
function viewLogoSitemap(){
	document.getElementById('divLogoOverSitemap').style.display='block';
}
function unviewLogoSitemap(){
	document.getElementById('divLogoOverSitemap').style.display='none';
}
function viewLogoWhishlist(){
	document.getElementById('divLogoOverWhishlist').style.display='block';
}
function unviewLogoWhishlist(){
	document.getElementById('divLogoOverWhishlist').style.display='none';
}


function setContentHeight(){
	document.getElementById("alphaBlockContent").style.height=document.getElementById("contentBlockBG").clientHeight+"px";
	if(document.getElementById("contentBlockBG").clientHeight<380){
		document.getElementById("alphaBlockContent").style.height = "380px";
	}
}
function onFullScreen(){
	if(document.getElementById("helpData")){
		document.getElementById("podlojka").style.height=document.getElementById("helpData").clientHeight+"px";
		document.getElementById("podlojka").style.width=document.getElementById("helpData").clientWidth+"px";
	}
}
function changeLink(id){
	for(i=0;i<id_arr.length;i++){
		if(id_arr[i]==id){
			document.getElementById(id_arr[i]).className="menuGalOn";
		}
		else{
			document.getElementById(id_arr[i]).className="menuGal";
		}
	}
}
function changeLinkVideo(videoLink){
	var videoItems = document.getElementById("vedoeItems").getElementsByTagName("a");
	for(i=0;i<videoItems.length;i++){
		if(videoItems[i].className == "menuVideoOn" || videoItems[i].className == "menuVideo menuVideoOn"){
			videoItems[i].className="menuVideo";
			break;
		}
	}
	for(i=0;i<videoItems.length;i++){
		if(videoItems[i] == videoLink){
			videoItems[i].className += " menuVideoOn";
			break;
		}
	}
	
}
/* for message board */
function showBoard(lnk,num,pathActive,pathPassive){
	for(i=1;i<3;i++){
		if(num==i){
			lnk.className = "linkboard"+i+"On";
			lnk.getElementsByTagName("img")[0].src=pathActive;
			document.getElementById("contentBoard"+i).style.display = "block";
		}
		else{
			document.getElementById("linkboard"+i).className = "linkboard"+i;
			document.getElementById("linkboard"+i).getElementsByTagName("img")[0].src=pathPassive;
			document.getElementById("contentBoard"+i).style.display = "none";
		}
	}	
}
function showOnly(num){
	for(i=1;i<3;i++){
		if(num==i){
			document.getElementById("linkboard"+i).style.display = "block";
			document.getElementById("linkboard"+i).className = "linkboardOnce";
			document.getElementById("contentBoard"+i).style.display = "block";
		}
		else{
		    if(document.getElementById("linkboard"+i))
		    {
			document.getElementById("linkboard"+i).style.display = "none";
			document.getElementById("contentBoard"+i).style.display = "none";
		    }
		}
	}	
}
function hideFocus(){
	if(document.getElementById("hiddenFocus")){
		document.getElementById("hiddenFocus").focus();
	}
}
function changePicture(pic,loc){
	var mes_opt,pro_opt;
	if(switcher == 1){
		mes_opt = "_down";
		pro_opt = "_up";
	}
	else if(switcher == 2){
		mes_opt = "_up";
		pro_opt = "_down";
	}
	if(pic=="pic1"){
		document.getElementById("pic1").src = "../_common/img/"+loc+"/messboard.gif";
		document.getElementById("pic2").src = "../_common/img/"+loc+"/promo"+pro_opt+".gif";
	}
	else{
		document.getElementById("pic1").src = "../_common/img/"+loc+"/messboard"+mes_opt+".gif";
		document.getElementById("pic2").src = "../_common/img/"+loc+"/promo.gif";
	}
}

function MoveUp()
{
	var effect = new Fx.Style('BigBox', 'marginTop', {
	duration: 500, 
	transition: Fx.Transitions.Sine.easeInOut
	});
	
	var top = document.getElementById("BigBox").style.marginTop;
	
	if (top == "")
		top = 0+"px";
	 
	if (top.substr(0,top.length-2)*1 >= limit.substr(0,limit.length-2)*1+countofitems*heightBlock){
		effect.start(parseInt(top)-heightBlock);
	}
}

function MoveDown()
{
	var effect = new Fx.Style('BigBox', 'marginTop', {
	duration: 500, 
	transition:  Fx.Transitions.Sine.easeInOut
	});
	var top = document.getElementById("BigBox").style.marginTop;	
	
	if (top == "" || top.substr(0,top.length-2)*1>=0){
		top = 0+"px";
	}
	
	if (top.substr(0,top.length-2)*1<=-heightBlock){
		effect.start(parseInt(top)+heightBlock);
	}	
}
/* end for message board */

function getResumeBlockHeight(){
	if(document.getElementById("bgSendResumeForm")){
		var idTimeout = setTimeout(getTable,1000);		
	}
	function getTable(){
		limit = 0-document.getElementById("bgSendResumeForm").clientHeight+"px";
	}
}
function setScrollOfForm(){
	getResumeBlockHeight();
	if(document.getElementById("bgSendResumeForm")){
		if(document.getElementById("prodArrowUp")){
			document.getElementById("prodArrowUp").style.display="block";
		}
		if(document.getElementById("prodArrowDown")){
			document.getElementById("prodArrowDown").style.display="block";
		}
	}
	else{
		if(document.getElementById("prodArrowUp")){
			document.getElementById("prodArrowUp").style.display="none";
		}
		if(document.getElementById("prodArrowDown")){
			document.getElementById("prodArrowDown").style.display="none";
		}
	}
}
function setSearch(){
	var opera = Boolean(window["opera"]);
	var MSIE = (navigator.appName.indexOf("Microsoft") != -1) && !opera;
	if(document.getElementById("searchBtn")){
		if(MSIE){
			document.getElementById("searchBtn").className = "searchBtn";			
		}
		else{
			document.getElementById("searchBtn").className = "searchBtn1";
		}
	}	
}
function checkSearch(){
	var seatxt = document.getElementById("filter");
	if(seatxt){
		if(seatxt.value.length>2){
			document.location.href = "../search/?filter="+seatxt.value;			
		}
		else{
			alert("length of search string too small");
		}
	}
}
function setGoogleBox(){
	this.ver=navigator.appVersion;
	this.agent=navigator.userAgent;
	this.dom=document.getElementById?1:0;
	this.opera5=this.agent.indexOf("Opera 5")>-1;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	if(document.getElementById("googleBox") && document.getElementById("googleBoxClose")){
		if(this.ie6 || this.ie7){
			document.getElementById("googleBox").style.top = "422px";
			document.getElementById("googleBoxClose").style.top = "421px";
		}
		else{
			document.getElementById("googleBox").style.top = "126px";
			document.getElementById("googleBoxClose").style.top = "108px";
		}
	}
	
}
function changePositionOfOveredMenuItem(img){
	img.style.position = "relative";
	img.style.top = "-8px";
}
function backPositionOfOveredMenuItem(img){
	img.style.top = "0px";
}


function validateEmail(email)
{
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(email))
        return true
    else
        return false;
}


function SubUser(id)
{
    emails = document.getElementById(id).value;
    if(!validateEmail(emails)) {
        alert ('Veuillez entrer votre courriel');
		return false;
	}
    else
    {
         window.location.href="../subscribe/?email="+emails;
    }  
}
function show_podcat(num, title){
	if(document.getElementById("mycustomscroll")){
		var rightMenuLinks = document.getElementById("mycustomscroll").getElementsByTagName("a");
		for(i=0;i<rightMenuLinks.length;i++){
			if(i == num){
				rightMenuLinks[i].className = "menuGalActive";
			}
			else{
				rightMenuLinks[i].className = "menuGal";	
			}
		}
	}
	
	var flashvars = {
	  mp3Path: "../home/sound/" + ar_podcast[num],
	  mp3Title: title
	};
	var params = {
	  wmode: "transparent"
	};
	var attributes = {
	  id: "potcastDiv",
	  name: "potcastDiv"
	};
	
	swfobject.embedSWF("../content/podcast.swf", "potcastDiv", "516", "94", "9.0.0","../_common/flash/expressInstall.swf", flashvars, params, attributes);
}

var greenTimeout;
function showGreenPopup(){
	show_hide_select("hidden");
	show_hide_video("hidden");
	clearTimeout(greenTimeout);
	document.getElementById("greenPopup").style.display = "block";
	var tabs = document.getElementById("greenPopup").getElementsByTagName("table");
	tabs[0].className = tabs[1].className = "tabGreenPopup";
	tabs[0].getElementsByTagName("td")[tabs[0].getElementsByTagName("td").length - 1].className = "last";
	tabs[1].getElementsByTagName("td")[tabs[1].getElementsByTagName("td").length - 3].className = "last";
}
function hideGreenPopup(){
	greenTimeout = setTimeout(function(){document.getElementById("greenPopup").style.display = "none";show_hide_select("visible");show_hide_video("visible");}, 500);
}
function set_classTableMap(){
	var tabs = new Array(document.getElementById("mapTab2").getElementsByTagName("table")[0],document.getElementById("mapTab1").getElementsByTagName("table")[0]);
	tabs[0].className = tabs[1].className = "tabGreenPopup";
	tabs[0].getElementsByTagName("td")[tabs[0].getElementsByTagName("td").length - 1].className = "last";
	tabs[1].getElementsByTagName("td")[tabs[1].getElementsByTagName("td").length - 3].className = "last";	
}

function show_alert_message(text){
	
	scrollY = getScrollH();
	show_hide_select("hidden");
	show_hide_video("hidden");
	document.getElementById("blackBg").style.display = 'block';
	document.getElementById("blackBg").style.height = document.body.clientHeight + 100 + "px";
	var popupBlock = document.getElementById("form_alert_message");
	popupBlock.style.top = scrollY + 100 + "px"; 
	popupBlock.style.display = "block";
	document.getElementById("alert_getstarted").innerHTML = text;
}

function hide_alert_message(){
	show_hide_select("visible");
	show_hide_video("visible");
	document.getElementById("blackBg").style.display = 'none';
	var popupBlock = document.getElementById("form_alert_message");
	popupBlock.style.display = "none";	
}


function show_iframe_pdf(pdf_link){
	
	scrollY = getScrollH();
	show_hide_select("hidden");
	show_hide_video("hidden");
	document.getElementById("blackBg1").style.display = 'block';
	document.getElementById("blackBg1").style.height = document.body.clientHeight + 100 + "px";
	var popupBlock = document.getElementById("form_iframe_pdf");
	popupBlock.style.top = scrollY + "px"; 
	popupBlock.style.display = "block";
	var iframe_pdfs = document.getElementById("iframe_pdf");
	iframe_pdfs.src = pdf_link;
}

function hide_iframe_pdf(){
	show_hide_select("visible");
	show_hide_video("visible");
	document.getElementById("blackBg1").style.display = 'none';
	var popupBlock = document.getElementById("form_iframe_pdf");
	popupBlock.style.display = "none";	
	var iframe_pdfs = document.getElementById("iframe_pdf");
	iframe_pdfs.src = '';
}


function show_hide_select(types)
{
	
	for(i=0;i<document.getElementsByTagName("select").length;i++){
		document.getElementsByTagName("select")[i].style.visibility = types;
	}
	
}
function show_hide_video(type){
	if(document.getElementById("contents")){
		document.getElementById("contents").style.visibility = type;
	}
}

function getScrollH()
{
	
	var scrollY = 0;
	if ( document.documentElement && document.documentElement.scrollTop ){
		scrollY = document.documentElement.scrollTop;
	}else if ( document.body && document.body.scrollTop ){
		scrollY = document.body.scrollTop;
	}else if ( window.pageYOffset ){
		scrollY = window.pageYOffset;
	}else if ( window.scrollY ){
		scrollY = window.scrollY;
	}
	return scrollY;
}

function ap_stopAll()
{
	
}

function doHidePopupProd() {
	if(document.getElementById("prodPopup")){
		document.getElementById("prodPopup").style.display = "none";
	}
}