/*java script file*/

function load_main_right ()
{ 
 var el = document.getElementById ('main_right');
 if (el)
 {
  var browserName=navigator.appName;
  if (browserName=="Microsoft Internet Explorer")
  {
   el.style.backgroundImage = 'url("img/main_right_IE.gif")';
  }
  else
  {
   el.style.backgroundImage = 'url("img/main_right.gif")';
  }
 }
}

// pre-load imagini
function preload_imgs ()
{
	load_main_right ();
	if (document.images)
    {
	 var a = preload_imgs.arguments;
     document.pic = new Array;
	 for (var i=0; i<a.length; i++)
	 {
		 document.pic[i] = new Image;
		 document.pic[i].src = a[i];
	 }
   }
}

function lightup(imgNo)
{	
   if (document.images)
    {
		var el = document.getElementById ('pic'+imgNo);
		if (!el)
			return;
		el.src = document.pic[imgNo+5].src;
    }
}

function turnoff(imgNo)
{
   if (document.images)
    {
		var el = document.getElementById ('pic'+imgNo);
		if (!el)
			return;
		el.src = document.pic[imgNo].src;		
    }
}

function popup_img (idIm)
{
	if (document.images)
	{
		var oW = window.open("","img"+idIm,"toolbar=no,width=400,height=300,scrollbars=no");
		oW.document.open();
		oW.document.write ('<html><head></head><body>');
		var oImg = document.getElementById (idIm);
		if (oImg)
		{
			oW.document.write ('<img src='+oImg.src+' width="390" height="290">');
		}
		oW.document.write ('</body></html>');
		oW.document.close();
		oW.focus ();
	}
}

function check_form_user ()
{
	var el1 = document.getElementById ('new_pass');
	var el2 = document.getElementById ('new_pass2');
	if (el1.value != el2.value)
	{
		alert ('parola noua nu seamana cu confirmarea!');
		return false;
	}
	return true;
}

function GetXmlHttpObject()
			{
			  var xmlHttp=null;
			  try
				{
				// Firefox, Opera 8.0+, Safari
				xmlHttp=new XMLHttpRequest();
				}
			  catch (e)
				{
				// Internet Explorer
				try
				  {
				  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				  }
				catch (e)
				  {
				  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				  }
				}
			  return xmlHttp;
			}
			
			function stateChanged() 
			{ 
			if (xmlHttp.readyState==4)
			{ 
			document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
			}
			}
			
			var xmlHttp
			
			function showHint(str)
			{
			if (str.length==0)
			  { 
			  document.getElementById("txtHint").innerHTML="";
			  return;
			  }
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			  {
			  alert ("Your browser does not support AJAX!");
			  return;
			  } 
			var url="http://media-concept.ro/ajax.php?action=get";
			url=url+"&q="+str;
			url=url+"&sid="+Math.random();
			xmlHttp.onreadystatechange=stateChanged;
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
			}
