function changeBg(el,stat,color_over, color_out){
	var myel;
if (color_over==0 || color_over==undefined)
	color_over='#FFFFFF';
	if (color_out==0 || color_out==undefined)
	color_out='#000000';
	if (stat){
		document.getElementById(el).style.backgroundPosition="left -21px";
		document.getElementById(el).style.color=color_over;
	}else{
		document.getElementById(el).style.backgroundPosition='top left';
		document.getElementById(el).style.color=color_out;
	}
}

function isEmail(who) {
	var email=/^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;
	return(email.test(who));
}

function isAplhaNum(who) {
	var filt=/[^A-Za-z0-9]/;
	return(!filt.test(who));
}


function isFilled(who){
	return (who.value!='');
}  		  		
function areEqual(who1,who2){
	return (who1.value==who2.value);
} 

function check(obj){
	var err = '';
	var fil = '';
	var ret = '';

	if (!isFilled(obj.nume)){
		fil=fil+'-numele\n';
	}
	if (!isFilled(obj.prenume)){
		fil=fil+'-prenumele\n';
	}				
	if (!isFilled(obj.email)){
		fil=fil+'-adresa de email\n';
	}else{
		if (!isEmail(obj.email.value)){
			err=err+'-adresa de email\n';
		}
	}
	if (isFilled(obj.parola) && isFilled(obj.reparola)){
		if (!areEqual(obj.parola,obj.reparola)){
			err=err+'-parolele nu se potrivesc\n';	
		}
	}else{
		fil=fil+'-parola\n';
	}
	if (fil!=''){
		ret='Campuri necompletate:\n'+fil;
	}
	if (err!=''){
		ret=ret+'\nCampuri Invalide:\n'+err;
	}
	return ret;
}

//IE FLICKER FIX :d
try {
 	  document.execCommand("BackgroundImageCache", false, true);
  }
catch(err) {}

var ie=document.all
var ns6=document.getElementById && !document.all
function showPopUp(){
	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 report_comment(cid,type) {
	if(jQuery !== undefined) {
		$.ajax({
		   type: 'POST',
		   url:  'http://www.kidz.ro/ajax.php',
		   data: 'act=report_comment&cid=' + cid + '&type=' + type,
		   success: function(result){			
				if(result.success) {
					alert('Comentariul a fost raportat!');
				}
		   },
		   dataType: 'json'
		 });
	}
}
