function changeBg(el,stat){
	if (stat){
		el.className='menu_hover';
	}else{
		el.className='menu_out';
	}
}
//IE FLICKER FIX :d
try {
 	  document.execCommand("BackgroundImageCache", false, true);
  }
catch(err) {}

var ie=document.all
var ns6=document.getElementById && !document.all
function showPopUp(){
	if(document.getElementById('pWinConfig'))
	document.getElementById('pWinConfg').style.visibility='visible';
}
function hidePopUp(){
	document.getElementById('pWinConfg').style.visibility='hidden';
}
function startPopUp(){
	timerID=setTimeout('showPopUp()',3000);
}

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}
function setCookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

function loadornot(){
	if (get_cookie('popunder')=='true'){
		startPopUp();
		setCookie("popunder","false",1,"/","www.garbo.ro");
	}
}

function popupform(myform, url, windowname){
	if (! window.focus)return true;
	window.open(url, windowname, 'height=600,width=820,scrollbars=yes');
	myform.target=windowname;
	return true;
}
loadornot();

function anulez() {
document.forma_taxa.taxa.value = " ";
document.forma_taxa.c1.value = " ";
document.forma_taxa.c2.value = " ";
document.forma_taxa.c3.value = " ";
document.forma_taxa.taxalei.value = " ";
}
function taxa_masini() {
var Avar = 0;
var Bvar = 0;
var Cvar = 0 ;
var Dvar = 0 ;
var taxaluc = 0;
var taxaluc2 = 0;
var a4 = new Array(27);
var a5c2 = new Array(5);
var a5c3 = new Array(5);
var a41 = new Array(7);
var nr1 = 0;
var nr2 = 0;
var va4 = 0;
var va5 = 0;
var NU = 0;
var varll =0;
a41[1] = 0;
a41[2] = 0;
a41[3] = 0;
a41[4] = 0.2;
a41[5] = 0.9;
a41[6] = 1.2;
a4[0] = 0;
a4[1] = 0.15;
a4[2] = 0.35;
a4[3] = 0.5;
a4[4] = 0.7;
a4[5] = 1;
a4[6] = 0.5;
a4[7] = 0.6;
a4[8] = 0.9;
a4[9] = 1.1;
a4[10] = 1.3;
a4[11] = 1.3;
a4[12] = 1.4;
a4[13] = 1.5;
a4[14] = 1.6;
a4[15] = 1.7;
a4[16] = 1.8;
a4[17] = 1.8;
a4[18] = 1.8;
a4[19] = 1.8;
a4[20] = 1.8;
a4[21] = 2;
a4[22] = 2;
a4[23] = 2;
a4[24] = 2;
a4[25] = 2;
a4[26] = 2;
a5c2[0] = 0.9;
a5c2[1] = 1.8;
a5c2[2] = 2.3;
a5c2[3] = 2.5;
a5c2[4] = 2.7;
a5c3[0] = 15;
a5c3[1] = 25;
a5c3[2] = 32;
a5c3[3] = 43;
a5c3[4] = 47;
Avar = eval(document.forma_taxa.capacitate.value);
va4 = eval(document.forma_taxa.norma.value);
va5 = eval(document.forma_taxa.varsta.value);
NU =  eval(document.forma_taxa.categorie.value);
if (va4 == 0 ) alert (" Selectati Norma de poluare ");
if (va4 == 1 ) {
   document.forma_taxa.taxa.value = 0;
   alert("Taxa este 0"); }
 else {
    if (Avar == null )alert (" Itroduceti capacitatea cilindrica "); 
        else {
        if (va5 == 0 ) alert (" Selectati varsta autoturismului ");
         else {
           if (Avar <= 1600 ) nr1 = 1;
           if (Avar > 1600 && Avar <= 2000) nr1 = 2;
           if (Avar > 2000 && Avar <= 2500) nr1 = 3;
           if (Avar > 2500 && Avar <= 3000) nr1 = 4;
           if (Avar > 3000) nr1 = 5; 
           nr2 = (va4 -2)*5 + nr1  ;  
         if (NU <= 1 )  Bvar = a4[nr2]; 
              else Bvar = a41[va4]; 
           Cvar = a5c2[va5-1];
           Dvar = a5c3[va5-1];
taxaluc = Avar*Bvar*Cvar*(100-Dvar)/100; 
varluc2= taxaluc*document.forma_taxa.curs.value; 
document.forma_taxa.taxalei.value = Math.round(varluc2*100)/100;
document.forma_taxa.taxa.value = taxaluc; 
document.forma_taxa.c1.value = Bvar;
document.forma_taxa.c2.value = Cvar;
document.forma_taxa.c3.value = Dvar;
  } 
  }
  }
  }
  
function report_comment(cid,type) {
	if(jQuery !== undefined) {
		$.ajax({
		   type: 'POST',
		   url:  'http://www.sotto.ro/ajax.php',
		   data: 'act=report_comment&cid=' + cid + '&type=' + type,
		   success: function(result){			
				if(result.success) {
					alert('Comentariul a fost raportat!');
				}
		   },
		   dataType: 'json'
		 });
	}
}

$(document).ready(function() { 
	if (window.poppic) {
		open_picture_window(poppic);
		document.location.hash = 'galerie-foto';
	}
});

function open_picture_window(url) {
	//var fWP = window.open(url, 'gf_picture', 'location=1,status=1,scrollbars=1,resize=0,width='+(screen.width-40)+',height='+(screen.height-40)+'');
	
	var fWP = window.open(url, 'gf_picture', 'location=1,status=1,scrollbars=1,resize=0,width=980,height=800');
	fWP.focus();
	
	return false;
}
