$(document).ready(function(){
	var bb = new Array();
	
	/*$("div[id^='meniu1-buton-']").hover(
		function(ev){
			var asta = this.id;
			$("#"+asta).animate({ 
				"marginLeft": "0px"
			}, 500);
			//ev.animateToClass("meniu_item", 1000); 
			//ev.animate({ "margin-left" : "0px"}, 1000);
		},
		function (ev){
			var asta = this.id;
			$("#"+asta).animate({ 
				"marginLeft": "85px"
			}, 500);
		}
	);*/
	
	$("div[id^='meniu-buton_h-']").mouseleave(
		function(ev){
			var asta = this.id;
			var nr = asta.replace('meniu-buton_h-','');
			bb[nr] = 1;
			$("#"+asta).animate({ 
				"marginLeft": "85px"
			}, 500,'',function(){bb[nr] = 0});
			
		}
	);
	$("div[id^='meniu-buton_h-']").mouseover(
		function(ev){
			var asta = this.id;
			var nr = asta.replace('meniu-buton_h-','');
			if(bb[nr] != 1){
				$("#"+asta).animate({ 
					"marginLeft": "0px"
				}, 500);
			}
		}
	);
	
	
	
	
	
	var fp1_open = 0;
	var fp2_open = 0;
	var fp3_open = 0;
	//paragrafele din frontpage, dreapta
	$("#fp_1_1").mousemove(function(){
		if(fp1_open==0){
			$("#dh_fp1").show('slow');
			fp1_open = 1;
		}
	});
	$("#fp_1_1").mouseleave(function(){
		$("#dh_fp1").hide('slow', function(){
		fp1_open = 0;
		});
	});
	
	$("#fp_2_1").mousemove(function(){
		if(fp2_open==0){
			$("#dh_fp2").show('slow');
			fp2_open = 1;
		}
	});
	$("#fp_2_1").mouseleave(function(){
		$("#dh_fp2").hide('slow', function(){
		fp2_open = 0;
		});
	});
	
	$("#fp_3_1").mousemove(function(){
		if(fp3_open==0){
			$("#dh_fp3").show('slow');
			fp3_open = 1;
		}
	});
	$("#fp_3_1").mouseleave(function(){
		$("#dh_fp3").hide('slow', function(){
		fp3_open = 0;
		});
	});

	/* ==============  FORMULES  ================  */
	$("div[id^='pres-']").click(function(){
			close_formula();
			var asta = this.id;
			var nr = asta.replace('pres-','');
			$("#pres-"+formula_deschisa).mouseleave();
			$("#hep-"+nr).removeClass('pres_ver_titlu');
			$("#hep-"+nr).addClass('pres_ver_titlu_h');
			$("#co-"+nr).show('fast');
			formula_deschisa = nr;
	});
	function close_formula(){
		//$("div[id^='pres-']").mouseleave(function(){
				//var asta = this.id;
				//var nr = asta.replace('pres-','');
				//$("#hep-"+nr).removeClass('pres_ver_titlu_h');
				//$("#co-"+nr).hide('fast');
				$("h2[id^='hep-']").removeClass('pres_ver_titlu_h');
				$("h2[id^='hep-']").addClass('pres_ver_titlu');
				$("span[id^='co-']").hide('fast');
				//$("#co-"+nr).hide('fast');
				formula_deschisa = 0;
		//});
	}
	
		
	$('#ul_galerie').jqGalViewII();
	
	
	$("#objet_selector").change(function(){ 
		//alert(this.value);
		var objet = this.value;
		if(objet=='Recrutement'){
			$("#siviu").show();
			$("#scrisoare").show();
			$("#raisonsoc").hide();
		}
		else {
			$("#siviu").hide();
			$("#scrisoare").hide();
			$("#raisonsoc").show();
		}
	});
	
	$("#objet_selector").change();


	/*$('.media').media({
			width:     334, 
			height:    260, 
			src:       '/extras/film3.flv', 
			flashvars: {
					autostart: 'true',
					backcolor: '111111',
					frontcolor: 'cccccc',
					lightcolor: '66cc00',
					playlistsize: '200',
					skin: '/extras/stylish.swf',
					image:'/extras/images/video.jpg',
					//controlbar: 'over',
					repeat: 'always'
					//playlist: 'bottom'
					},
			//attrs:     { attr1:  'attrValue1',  attr2:  'attrValue2' },  // object/embed attrs 
			//params:    { param1: 'paramValue1', param2: 'paramValue2' }, // object params/embed attrs 
			caption:   false // supress caption text 
		});*/

	var newsoption = {
	firstname: "mynews",
	secondname: "showhere",
	thirdname:"news_display",
	fourthname:"news_button" ,
	playingtitle:"Now Playing:",
	nexttitle:"Next News:",
	prevtitle:"prev News:",
	newsspeed:'9000',
	isauto:'1',
	newscountname:"test",
	imagedir:'/extras/images/news_pro/',
	disablenewscount:true
	}
	$.init_plus(newsoption);
	
	var newsoption2 = {
	firstname: "mynews2",
	secondname: "showhere2",
	thirdname:"news_display2",
	fourthname:"news_button2" ,
	playingtitle:"Now Playing:",
	nexttitle:"Next News:",
	prevtitle:"prev News:",
	newsspeed:'11000',
	isauto:'1',
	newscountname:"test2",
	imagedir:'/extras/images/news_pro/',
	disablenewscount:true
	}
	$.init_plus2(newsoption2);


	var COOKIE_NAME = 'afisare_anunt_reclama';
    //var ADDITIONAL_COOKIE_NAME = 'additional';
    var options = { path: '/', expires: 1 };
	var date = new Date();
    date=date.getTime();
	//alert(date);
	var cuki = $.cookie(COOKIE_NAME);
	cuki = parseInt(cuki);
	if(isNaN(cuki)){cuki=0;}
	if(cuki>=10){ cuki=0; }
	//alert(cuki);
	if(cuki==0){
		$(".a_reclama_p").ceebox();
		$("#cee_box").css('top', '250px');
		$(".a_reclama_p").click();
		$("#cee_load").hide();
		//$.cookie(COOKIE_NAME, parseInt(cuki)+1, options);
	}
	$.cookie(COOKIE_NAME, parseInt(cuki)+1, options);
	
});