//functions for canceling some events



function CancelEvent(){

    event.returnValue = false;

}



function CancelF5(){

    if(event.keyCode==116){

	window.event.keyCode = 0;	

	event.returnValue = false;

    }

}



function unsetButtons(){

  document.getElementById("MenuCat1").className="MenuOut";

  document.getElementById("MenuCat2").className="MenuOut";

  document.getElementById("MenuCat3").className="MenuOut";

  document.getElementById("MenuCat4").className="MenuOut";

  document.getElementById("MenuCat5").className="MenuOut";

  document.getElementById("MenuCat6").className="MenuOut";

}





// functions for Menu Behaviour

function setButton(obj){

    unsetButtons(); 

    obj.className="MenuSelected";

}





function ChangeSubmenu(page, lang){

    var FrameHeight = 0;

    if(lang=='?en'){

	tmplpath='tmpl_en/'

    }

    else{

	tmplpath='tmpl/'

    }

    //Load the default page into frame

    switch(page){

	case 0: break;

	case 1: FrameHeight = 203;

		frames.MainFrame.document.location.href = tmplpath + "vocation.html";

		break;

	case 2: FrameHeight = 142; 

		frames.MainFrame.document.location.href = tmplpath + "competences.html";

		break;

        case 3: FrameHeight = 136; 

		frames.MainFrame.document.location.href = tmplpath + "equipedediee.html";

		break;

        case 4: FrameHeight = 136; 

		frames.MainFrame.document.location.href = tmplpath + "pointdevente.html";

		break;

        case 5: FrameHeight = 72; 

		frames.MainFrame.document.location.href = tmplpath + "jobs.html";

		break;

	case 6: FrameHeight = 72; 

		frames.MainFrame.document.location.href = tmplpath + "communiques.php" + lang;

		break;

    }

    //Load Submenu

    document.getElementById('SubCatFrame').height = FrameHeight;

    document.getElementById('SubCatRow').height = FrameHeight;

	frames['SubCatFrame'].document.location.href="menu/menu" + page + ".html" + lang;

  // document.all.SubCatFrame.src =  "menu/menu" + page + ".html" + lang;  

}





//functions for submenu behaviour

function LoadFrame(page, lang){

    if(lang=='?en'){

	tmplpath='tmpl_en/'

    }

    else{

	tmplpath='tmpl/'

    }



    //first, change all menu classes

    unsetButtons();

    frames['SubCatFrame'].height = 0;

    frames['SubCatFrame'].document.location.href =  "menu/menuX.html";

    frames['MainFrame'].document.location.href = tmplpath + page + lang;

    //daca nu reincarcam imaginea, se opreste animatia... la linkurile din footer...

    document.getElementById('sag01').src = 'img/sag01.gif';

    if(lang=='?en'){

	document.getElementById('flag_img').src='img/flag-fr.gif';

    }

    else{

	document.getElementById('flag_img').src='img/flag-uk.gif';

    }

    document.getElementById('SubCatRow').height = 1;    

    document.getElementById('SubCatFrame').height = 1;    

}



//----------------------------------------------

function LoadStartPages(){

    //set language

    if(location.search=='?lang=en'){

    };

    //end set language

    //alert("inaltime: " + screen.height);

    if(self.screen){

	if(screen.height>800){

	    //document.all.CutPage.height

	    document.all.CutPage.topmargin = 100;

	}

    }

    LoadFrame('accueil.html', location.search);

    

    document.onkeydown = CancelF5;

    document.oncontextmenu = CancelEvent;

}



//functions for  Search button behaviour

function SearchPages(aString, lang){

    parent.document.all.MainFrame.src="search.php?text=" + escape(aString) + "&lang=" + lang.slice(1,2);

}



function EnterOnSearch(aString){

    if(event.keyCode==13){

	window.event.keyCode = 0;

	event.returnValue = false;

	SearchPages(aString, location.search)

    }

}





// display a new window with the myimage

function display(myimage) {

 html = "<HTML><HEAD><TITLE>Photo</TITLE>" +

  "</HEAD><BODY LEFTMARGIN=0 " +

  "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>" +

  "<IMG SRC='" + myimage + "' BORDER=0 NAME=image " +

  "onload='window.resizeTo(document.image.width,document.image.height)'></CENTER>" +

  "</BODY></HTML>";

 popup=window.open

   ('','image','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1');

 popup.document.open();

 popup.document.write(html);

 popup.document.focus();

 popup.document.close()

 };



// display a new window with the aLink

function openLink(aLink) {

 popup=window.open

   (aLink,'','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1, resizable=1,width=820');

 }



function MailThis(subject){

  alert(subject);

  window.location='mailto:jobs@kepler-rominfo.com?subject='+subject;

}



