function Increment(txtBox){
	try {if(txtBox.value<99)txtBox.value=eval(txtBox.value+ "+1");}
	catch (_e) {txtBox.value="0";}
}
function Decrement(txtBox){
	try {if(txtBox.value>0)txtBox.value=eval(txtBox.value+ "-1");}
	catch (_e) {txtBox.value="0";}
}

//Homeoff = new Image();			Homeoff.src = "images/menu/home.gif";
//Homeon = new Image();			Homeon.src = "images/menu/home-h.gif";
//Serviciioff = new Image();		Serviciioff.src = "images/menu/servicii.gif";
//Serviciion = new Image();		Serviciion.src = "images/menu/servicii-h.gif";
//Portofoliuoff = new Image();	Portofoliuoff.src = "images/menu/portofoliu.gif";
//Portofoliuon = new Image();		Portofoliuon.src = "images/menu/portofoliu-h.gif";
//Hardwareoff = new Image();		Hardwareoff.src = "images/menu/hardware.gif";
//Hardwareon = new Image();		Hardwareon.src = "images/menu/hardware-h.gif";
//Despreoff = new Image();		Despreoff.src = "images/menu/despre.gif";
//Despreon = new Image();			Despreon.src = "images/menu/despre-h.gif";
//Hartaoff = new Image();		Hartaoff.src = "images/menu/harta.gif";
//Hartaon = new Image();		Hartaon.src = "images/menu/harta-h.gif";
//Internetoff = new Image();		Internetoff.src = "images/menu/internet.gif";
//Interneton = new Image();		Interneton.src = "images/menu/internet-h.gif";
//Contactoff = new Image();		Contactoff.src = "images/menu/contact.gif";
//Contacton = new Image();		Contacton.src = "images/menu/contact-h.gif";

function imgOn(imgName) {if (document.images) {document[imgName].src = eval(imgName + "on.src");}}
function imgOff(imgName) {if (document.images) {document[imgName].src = eval(imgName + "off.src");}}

function PopWindow(url,name,width,height,loc,status,menu,scroll,resize,per,tool) {
	var LeftW = (screen.width-width)/2;
	var TopW = (screen.height-20-height)/2;
	PopupWin = window.open(url,name,'width='+width+',height='+height+',locationbar='+loc+',statusbar='+status+',menubar='+menu+',scrollbars='+scroll+',resizable='+resize+',personalbar='+per+',toolbar='+tool+',left='+LeftW+',top='+TopW);
	PopupWin.focus();
}

numeluna = new Array("Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie");
numeziua = new Array("Duminica","Luni","Marti","Miercuri","Joi","Vineri","Sambata");
function datacrt() {
   var azi = new Date();
   var numarziua=azi.getDay();
   var ziua = azi.getDate();
   var luna = azi.getMonth();
   document.write(numeziua[numarziua] + ', ' + ziua + ' '  + numeluna[luna]  + ' ' + '&nbsp;');
}

function Request(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
	}	
}

function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

function Delete_Cookie(name,path,domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function OnCatImg(imgName) {imgName.className='img_cat_on';}
function OffCatImg(imgName) {imgName.className='img_cat_off';}
function OnCatImgBw(imgName) {imgName.className='img_cat_bw_on';}
function OffCatImgBw(imgName) {imgName.className='img_cat_bw_off';}

function ajaxGetPage2Layer(urlPage,container) {
	var xmlHttp;
	var response;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();    
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}

	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			response=xmlHttp.responseText;
			object=document.getElementById(container);
			if(response.length==0) {
				object.innerHTML="";
				//cuvasc.style.display="none";
			} else {
				object.innerHTML=response;
			}
		}
	}
	xmlHttp.open("GET",urlPage,true);
	xmlHttp.send(null);
}

function hideAllCombos() {
	allCombos=document.getElementsByTagName("select");
	for (i=0; i<allCombos.length; i++) { 
		allCombos[i].style.visibility='hidden'; 
	}
}
function showAllCombos() {
	allCombos=document.getElementsByTagName("select");
	for (i=0; i<allCombos.length; i++) { 
		allCombos[i].style.visibility=''; 
	}
}
function showAllByTag(tagName) {
	var elements = document.getElementsByTagName(tagName);
	var i = 0;
	while (i < elements.length) {
		elements[i].style.visibility = "visible";
		i++;
	}
}

//4 sub search
function ajaxGetPage2LayerSubSearch(qstr) {
	if(qstr.length<3) {
		hideSubSearch();
		return false;
	}
	var xmlHttp;
	var response;
	object=document.getElementById("subSearchLayer");
	
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();    
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}

	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			response=xmlHttp.responseText;
			if(response.length<5) {
				object.innerHTML="";
				hideSubSearch();
			} else {
				object.innerHTML=response;
				showSubSearch();
			}
		}
	}
	xmlHttp.open("GET","/sub_search.php?qstr="+qstr,true);
	xmlHttp.send(null);
}

function hideSubSearch() {
	subSearchLayerX=document.getElementById("subSearchLayer");
	subSearchLayerX.style.display="none";
}

function showSubSearch() {
	subSearchLayerX=document.getElementById("subSearchLayer");
	subSearchLayerX.style.display="";
}

function SearchBoxOnFocus(box) {
	subSearchLayerX=document.getElementById("subSearchLayer");
	hideAllCombos();
	if(box.value=='Cautare produse...'){
		box.value='';
		box.className='frm_search';
	}
	
}
function SearchBoxOnBlur(box) {
	showAllCombos();
	if(box.value==''){
		box.value='Cautare produse...';
		box.className='frm_search_gray';
	}
}

document.onclick = hideSubSearch;
