/*
Copyright gamemag.ro 2007
Designed and developed by Galaxy Design
www.galax.ro
*/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function select_type()
{
	if (document.getElementById('tip_factura').value == "fizica")
	{
		document.getElementById('juridica').style.display = 'none';
	}
	else if (document.getElementById('tip_factura').value == "juridica")
	{
		document.getElementById('juridica').style.display = 'inline';
	}
}
function validate_reg_form()
{
		var filter=/^[A-Za-z0-9_\-.]+@+[A-Za-z_0-9\-.]+\.[A-Za-z][^\.]+$/
		if (document.getElementById('user').value == "")
		{
			alert("Va rugam introduceti numele de utilizator!");
			isValid = false;
			document.getElementById('user').focus();
		}
		else if (document.getElementById('parola').value == "")
		{
			alert("Va rugam introduceti corect parola!");
			isValid = false;
			document.getElementById('parola').focus();
		}
		else if (document.getElementById('confirmaparola').value == "" || document.getElementById('confirmaparola').value != document.getElementById('parola').value)
		{
			alert("Va rugam confirmati parola!");
			isValid = false;
			document.getElementById('confirmaparola').focus();
		}
		else if (document.getElementById('nume').value == "")
		{
			alert("Va rugam introduceti numele!");
			isValid = false;
			document.getElementById('nume').focus();
		}
		else if (document.getElementById('prenume').value == "")
		{
			alert("Va rugam introduceti prenumele!");
			isValid = false;
			document.getElementById('prenume').focus();
		}
		else if (document.getElementById('adresa').value == "")
		{
			alert("Va rugam introduceti adresa!");
			isValid = false;
			document.getElementById('adresa').focus();
		}
		else if (document.getElementById('localitate').value == "")
		{
			alert("Va rugam introduceti localitatea!");
			isValid = false;
			document.getElementById('localitate').focus();
		}
		else if (document.getElementById('judet').value == "")
		{
			alert("Va rugam selectati judetul!");
			isValid = false;
			document.getElementById('judet').focus();
		}
		else if (document.getElementById('telefon').value == "")
		{
			alert("Va rugam introduceti telefonul!");
			isValid = false;
			document.getElementById('telefon').focus();
		}
		else if (document.getElementById('mail').value == "" || !filter.test(document.getElementById('mail').value))
		{
			alert("Va rugam introduceti o adresa de e-mail valida!");
			isValid = false;
			document.getElementById('mail').focus();
		}
		else if (document.getElementById('tip_factura').value == "fizica")
		{
			if (document.getElementById('cnp').value == "")
			{
				alert("Va rugam introduceti CNP-ul!");
				isValid = false;
				document.getElementById('cnp').focus();
			}
			else if (document.getElementById('act_id').value == "")
			{
				alert("Va rugam alegeti tipul actului de identitate!");
				isValid = false;
				document.getElementById('act_id').focus();
			}
			else if (document.getElementById('serie').value == "")
			{
				alert("Va rugam introduceti seria actului de identitate!");
				isValid = false;
				document.getElementById('serie').focus();
			}
			else if (document.getElementById('numar').value == "")
			{
				alert("Va rugam introduceti numarul actului de identitate!");
				isValid = false;
				document.getElementById('numar').focus();
			}
			else
			{
				isValid = true;
			}
		}
		else if (document.getElementById('tip_factura').value == "juridica")
		{
			if (document.getElementById('cnp').value == "")
			{
				alert("Va rugam introduceti CNP-ul!");
				isValid = false;
				document.getElementById('cnp').focus();
			}
			else if (document.getElementById('act_id').value == "")
			{
				alert("Va rugam alegeti tipul actului de identitate!");
				isValid = false;
				document.getElementById('act_id').focus();
			}
			else if (document.getElementById('serie').value == "")
			{
				alert("Va rugam introduceti seria actului de identitate!");
				isValid = false;
				document.getElementById('serie').focus();
			}
			else if (document.getElementById('numar').value == "")
			{
				alert("Va rugam introduceti numarul actului de identitate!");
				isValid = false;
				document.getElementById('numar').focus();
			}
			else if (document.getElementById('firma').value == "")
			{
				alert("Va rugam introduceti numele firmei!");
				isValid = false;
				document.getElementById('firma').focus();
			}
			else if (document.getElementById('cui').value == "")
			{
				alert("Va rugam introduceti codul unic de inregistrare al firmei!");
				isValid = false;
				document.getElementById('cui').focus();
			}
			else if (document.getElementById('regcom').value == "")
			{
				alert("Va rugam introduceti numarul de inregistrare la Registrul Comertului!");
				isValid = false;
				document.getElementById('regcom').focus();
			}
			else if (document.getElementById('adresafirma').value == "")
			{
				alert("Va rugam introduceti adresa firmei!");
				isValid = false;
				document.getElementById('adresafirma').focus();
			}
			else if (document.getElementById('banca').value == "")
			{
				alert("Va rugam introduceti numele bancii!");
				isValid = false;
				document.getElementById('banca').focus();
			}
			else if (document.getElementById('iban').value == "")
			{
				alert("Va rugam introduceti codul IBAN!");
				isValid = false;
				document.getElementById('iban').focus();
			}
			else
			{
				isValid = true;
			}
		}
		else
		{
			isValid = true;
		}
	
	if (isValid)
	{
		if (document.register.termeni.checked == false)
		{
			alert("Nu ati fost de acord cu termenii si conditiile!");
			isValid = false;
			//document.register.termeni.focus();
		}
		else
		{
			isValid = true;
		}
	}
	
	if (isValid)
	{
		document.register.submit();
	}
	
	
}
function validate_process()
{
		var filter=/^[A-Za-z0-9_\-.]+@+[A-Za-z_0-9\-.]+\.[A-Za-z][^\.]+$/
		/*
		*/
		if (document.getElementById('nume').value == "")
		{
			alert("Va rugam introduceti numele!");
			isValid = false;
			document.getElementById('nume').focus();
		}
		else if (document.getElementById('prenume').value == "")
		{
			alert("Va rugam introduceti prenumele!");
			isValid = false;
			document.getElementById('prenume').focus();
		}
		else if (document.getElementById('adresa').value == "")
		{
			alert("Va rugam introduceti adresa!");
			isValid = false;
			document.getElementById('adresa').focus();
		}
		else if (document.getElementById('localitate').value == "")
		{
			alert("Va rugam introduceti localitatea!");
			isValid = false;
			document.getElementById('localitate').focus();
		}
		else if (document.getElementById('judet').value == "")
		{
			alert("Va rugam selectati judetul!");
			isValid = false;
			document.getElementById('judet').focus();
		}
		else if (document.getElementById('telefon').value == "")
		{
			alert("Va rugam introduceti telefonul!");
			isValid = false;
			document.getElementById('telefon').focus();
		}
		else if (document.getElementById('mail').value == "" || !filter.test(document.getElementById('mail').value))
		{
			alert("Va rugam introduceti o adresa de e-mail valida!");
			isValid = false;
			document.getElementById('mail').focus();
		}
		else if (document.getElementById('tip_factura').value == "fizica")
		{
			if (document.getElementById('cnp').value == "")
			{
				alert("Va rugam introduceti CNP-ul!");
				isValid = false;
				document.getElementById('cnp').focus();
			}
			else if (document.getElementById('act_id').value == "")
			{
				alert("Va rugam alegeti tipul actului de identitate!");
				isValid = false;
				document.getElementById('act_id').focus();
			}
			else if (document.getElementById('serie').value == "")
			{
				alert("Va rugam introduceti seria actului de identitate!");
				isValid = false;
				document.getElementById('serie').focus();
			}
			else if (document.getElementById('numar').value == "")
			{
				alert("Va rugam introduceti numarul actului de identitate!");
				isValid = false;
				document.getElementById('numar').focus();
			}
			else
			{
				isValid = true;
			}
		}
		else if (document.getElementById('tip_factura').value == "juridica")
		{
			if (document.getElementById('cnp').value == "")
			{
				alert("Va rugam introduceti CNP-ul!");
				isValid = false;
				document.getElementById('cnp').focus();
			}
			else if (document.getElementById('act_id').value == "")
			{
				alert("Va rugam alegeti tipul actului de identitate!");
				isValid = false;
				document.getElementById('act_id').focus();
			}
			else if (document.getElementById('serie').value == "")
			{
				alert("Va rugam introduceti seria actului de identitate!");
				isValid = false;
				document.getElementById('serie').focus();
			}
			else if (document.getElementById('numar').value == "")
			{
				alert("Va rugam introduceti numarul actului de identitate!");
				isValid = false;
				document.getElementById('numar').focus();
			}
			else if (document.getElementById('firma').value == "")
			{
				alert("Va rugam introduceti numele firmei!");
				isValid = false;
				document.getElementById('firma').focus();
			}
			else if (document.getElementById('cui').value == "")
			{
				alert("Va rugam introduceti codul unic de inregistrare al firmei!");
				isValid = false;
				document.getElementById('cui').focus();
			}
			else if (document.getElementById('regcom').value == "")
			{
				alert("Va rugam introduceti numarul de inregistrare la Registrul Comertului!");
				isValid = false;
				document.getElementById('regcom').focus();
			}
			else if (document.getElementById('adresafirma').value == "")
			{
				alert("Va rugam introduceti adresa firmei!");
				isValid = false;
				document.getElementById('adresafirma').focus();
			}
			else if (document.getElementById('banca').value == "")
			{
				alert("Va rugam introduceti numele bancii!");
				isValid = false;
				document.getElementById('banca').focus();
			}
			else if (document.getElementById('iban').value == "")
			{
				alert("Va rugam introduceti codul IBAN!");
				isValid = false;
				document.getElementById('iban').focus();
			}
			else
			{
				isValid = true;
			}
		}
		else
		{
			isValid = true;
		}
	
	if (isValid)
	{
		if (document.getElementById('user'))
		{
			if (document.getElementById('user').value != "")
			{
				if (document.getElementById('parola').value == "")
				{
					alert("Va rugam introduceti corect parola!");
					isValid = false;
					document.getElementById('parola').focus();
				}
				else if (document.getElementById('confirmaparola').value == "" || document.getElementById('confirmaparola').value != document.getElementById('parola').value)
				{
					alert("Va rugam confirmati parola!");
					isValid = false;
					document.getElementById('confirmaparola').focus();
				}
				else
				{
					isValid = true;
				}
			}
		}
	}
	if (isValid)
	{
		if (document.process.termeni.checked == false)
		{
			alert("Nu ati fost de acord cu termenii si conditiile!");
			isValid = false;
			//document.register.termeni.focus();
		}
		else
		{
			isValid = true;
		}
	}
	
	if (isValid)
	{
		document.process.submit();
	}
	
	
}
function validate_change_pass()
{
	if (document.getElementById('parola').value == "")
		{
			alert("Va rugam introduceti corect parola!");
			isValid = false;
			document.getElementById('parola').focus();
		}
		else if (document.getElementById('confirmaparola').value == "" || document.getElementById('confirmaparola').value != document.getElementById('parola').value)
		{
			alert("Va rugam confirmati parola!");
			isValid = false;
			document.getElementById('confirmaparola').focus();
		}	
		else
		{
			isValid = true;
		}

	if (isValid)
	{
		document.change_pass.submit();
	}
}

function validate_edit_details()
{
		var filter=/^[A-Za-z0-9_\-.]+@+[A-Za-z_0-9\-.]+\.[A-Za-z][^\.]+$/
		if (document.getElementById('nume').value == "")
		{
			alert("Va rugam introduceti numele!");
			isValid = false;
			document.getElementById('nume').focus();
		}
		else if (document.getElementById('prenume').value == "")
		{
			alert("Va rugam introduceti prenumele!");
			isValid = false;
			document.getElementById('prenume').focus();
		}
		else if (document.getElementById('adresa').value == "")
		{
			alert("Va rugam introduceti adresa!");
			isValid = false;
			document.getElementById('adresa').focus();
		}
		else if (document.getElementById('localitate').value == "")
		{
			alert("Va rugam introduceti localitatea!");
			isValid = false;
			document.getElementById('localitate').focus();
		}
		else if (document.getElementById('judet').value == "")
		{
			alert("Va rugam selectati judetul!");
			isValid = false;
			document.getElementById('judet').focus();
		}
		else if (document.getElementById('telefon').value == "")
		{
			alert("Va rugam introduceti telefonul!");
			isValid = false;
			document.getElementById('telefon').focus();
		}
		else if (document.getElementById('mail').value == "" || !filter.test(document.getElementById('mail').value))
		{
			alert("Va rugam introduceti o adresa de e-mail valida!");
			isValid = false;
			document.getElementById('mail').focus();
		}
		else if (document.getElementById('tip_factura').value == "fizica")
		{
			if (document.getElementById('cnp').value == "")
			{
				alert("Va rugam introduceti CNP-ul!");
				isValid = false;
				document.getElementById('cnp').focus();
			}
			else if (document.getElementById('act_id').value == "")
			{
				alert("Va rugam alegeti tipul actului de identitate!");
				isValid = false;
				document.getElementById('act_id').focus();
			}
			else if (document.getElementById('serie').value == "")
			{
				alert("Va rugam introduceti seria actului de identitate!");
				isValid = false;
				document.getElementById('serie').focus();
			}
			else if (document.getElementById('numar').value == "")
			{
				alert("Va rugam introduceti numarul actului de identitate!");
				isValid = false;
				document.getElementById('numar').focus();
			}
			else
			{
				isValid = true;
			}
		}
		else if (document.getElementById('tip_factura').value == "juridica")
		{
			if (document.getElementById('cnp').value == "")
			{
				alert("Va rugam introduceti CNP-ul!");
				isValid = false;
				document.getElementById('cnp').focus();
			}
			else if (document.getElementById('act_id').value == "")
			{
				alert("Va rugam alegeti tipul actului de identitate!");
				isValid = false;
				document.getElementById('act_id').focus();
			}
			else if (document.getElementById('serie').value == "")
			{
				alert("Va rugam introduceti seria actului de identitate!");
				isValid = false;
				document.getElementById('serie').focus();
			}
			else if (document.getElementById('numar').value == "")
			{
				alert("Va rugam introduceti numarul actului de identitate!");
				isValid = false;
				document.getElementById('numar').focus();
			}
			else if (document.getElementById('firma').value == "")
			{
				alert("Va rugam introduceti numele firmei!");
				isValid = false;
				document.getElementById('firma').focus();
			}
			else if (document.getElementById('cui').value == "")
			{
				alert("Va rugam introduceti codul unic de inregistrare al firmei!");
				isValid = false;
				document.getElementById('cui').focus();
			}
			else if (document.getElementById('regcom').value == "")
			{
				alert("Va rugam introduceti numarul de inregistrare la Registrul Comertului!");
				isValid = false;
				document.getElementById('regcom').focus();
			}
			else if (document.getElementById('adresafirma').value == "")
			{
				alert("Va rugam introduceti adresa firmei!");
				isValid = false;
				document.getElementById('adresafirma').focus();
			}
			else if (document.getElementById('banca').value == "")
			{
				alert("Va rugam introduceti numele bancii!");
				isValid = false;
				document.getElementById('banca').focus();
			}
			else if (document.getElementById('iban').value == "")
			{
				alert("Va rugam introduceti codul IBAN!");
				isValid = false;
				document.getElementById('iban').focus();
			}
			else
			{
				isValid = true;
			}
		}
		else
		{
			isValid = true;
		}
	
	if (isValid)
	{
		document.process.submit();
	}
	
	
}
function hidestatus()
{
window.status=''
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus

function openwin($file,$width,$height) { 
	var w = $width;
	var h = $height;
	var wleft = (screen.width - w) / 2;
    var wtop = (screen.height - h) / 2;
	newwindow = window.open($file,'','scrollbars=1,width='+w+',height='+h+',top='+wtop+',left='+wleft);
	window.newwindow.close();
	setTimeout(location.reload(),2000);
}
function makerollover()
{
	//document.write('<iframe src="http://www.top100.ro/cgi-bin/vote.cgi?id=49830" width=0 height=0 scrolling=no frameborder=0></iframe>');
	//document.write('<iframe src="http://www.gamemag.ro/best_buy.html" width=0 height=0 scrolling=no frameborder=0></iframe>');
	//document.write('<iframe src="http://www.adultnetwork.ro/jocuripenet.htm" width=0 height=0 scrolling=no frameborder=0></iframe>');
}


function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
	return '<div class="newscell"><div class="newsimg"><img src="' + item.img + '" alt="' + item.title + '" width="75" height="106" border="0" align="left"></div><div class="newsNO">' + item.crt + '</div><div class="newsdescr"><a href="' + item.url + '" title="' + item.title + '">' + item.title + '</a></div></div>';
};



