function validare(){
		var re=/^\w+/;
    		var nume=re.test(document.formular.nume.value);
    		var telefon=re.test(document.formular.telefon.value);
		var lungime=re.test(document.formular.lungime.value);
		var latime=re.test(document.formular.latime.value);

    		if (nume==false){
    	     			alert('Completeaza campul: Nume  !');
        			document.formular.nume.focus();
        	 		return false;
                          	}
		if (telefon==false){
	    	     		alert('Completeaza campul: Telefon  !');
				document.formular.telefon.focus();
        	 		return false;
                          	}
		if (lungime==false){
	    	     		alert('Completeaza campul: Lungime  !');
				document.formular.lungime.focus();
        	 		return false;
                          	}
		if (latime==false){
	    	     		alert('Completeaza campul: Latime  !');
				document.formular.latime.focus();
        	 		return false;
                          	}
		return true;
}
function formHandler(adresa)
{
	//var URL = document.URL.options[document.form.URL.selectedIndex].value;
	
	window.location.href = adresa+"&idselected=1";
	
	//if (URL != '') {
	//	window.location.href = URL;
	//}
	//else {
	//	document.form.URL.options[0].selected = true;
	//}
} 

function errorHandler(message, url, line)
{
//    alert("line: "+line + " - " + message);
    return true;  
}

// install the handler
window.onerror = errorHandler;

function resizeHandler(){

		var Combo=document.getElementById('Combo');
		var histo=document.getElementById('histo');
		var histo1=document.body;
		Combo.style.top=histo.offsetTop+22;
		Combo.style.left=histo.offsetLeft+534;
		var Contur=document.getElementById('Contur');
		Contur.style.height=282+2;
		Contur.style.width=225;
		Contur.style.top=histo.offsetTop+21;
		Contur.style.left=histo.offsetLeft+533;
		var div1=document.getElementById('div1');
		if(div1!=null){
			div1.style.top=histo.offsetTop+23;
			div1.style.left=histo.offsetLeft+460;
		}
		var div2=document.getElementById('div2');
		if(div2!=null){
			div2.style.top=histo.offsetTop+570;
			div2.style.left=histo.offsetLeft+383;
		}
	
}
window.onresize = resizeHandler;

function resizediv(){
	return;
		var div1=document.getElementById('div1');
		div1.style.top=histo.offsetTop+23;
		div1.style.left=histo.offsetWidth/2+88;
		
		var div2=document.getElementById('div2');
		div2.style.top=histo.offsetTop+123;
		div2.style.left=histo.offsetWidth/2+11;

}


//GENERIC DROP DOWN NAVIGATION
function goDropDown(strForm,strElement) {
	var objElement = eval('document.' + strForm + '.' + strElement);
	var objElementValue = objElement[objElement.selectedIndex].value;
	if (objElementValue != "") {
		window.location = objElementValue;
	}
}

//RETURN FROM CHILD WINDOW
function returnParent(strURL) {
	if(window.opener) {
		window.opener.location = strURL;
	}
	else if(window.parent) {
		window.parent.location = strURL;
	}
	window.close();
}

//GLOBAL POPUP
var objChildWindow;
function doChildWindow(strURL, objWin, strOptions) {
	//check for open windows and close them
	if (objChildWindow && objChildWindow.closed == false) {
		objChildWindow.close();

		objChildWindow = window.open(strURL, objWin, strOptions);
		objChildWindow.focus();
	}
	else {
		objChildWindow = window.open(strURL, objWin, strOptions);
		objChildWindow.focus();
	}
}

function openPrintPage(strURL) {
	var strOptions;
	strOptions = "toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,left=100,top=100,width=620,height=500";

	doChildWindow(strURL, 'child_window', strOptions);
	objChildWindow.focus();
}

//GLOBAL NEW WINDOW
function openNewWin(strURL, intWidth, intHeight) {
	var strOptions;
	//check for parameters and set defaults
	if ((intWidth == '') || (intHeight == '')) {
		strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=615,height=345";
	}
	else {
		intWidth += 45;
		intHeight += 45;
		strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=" + intWidth + ",height=" + intHeight;
	}
	doChildWindow(strURL, 'child_window', strOptions);
	objChildWindow.focus();
}

//VIEW LARGE IMAGE
function openNewImgWin(strImg, strTitle, intWidth, intHeight) {
	var strOptions;
	//check for parameters and set defaults
	if ((intWidth == '') || (intHeight == '')) {
		strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,left=100,top=100,width=400,height=400";
	}
	else {
		intWidth += 45;
		intHeight += 45;
		strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,left=100,top=100,width=" + intWidth + ",height=" + intHeight;
	}
	//check for browser and execute
	if (true) {
		doChildWindow('', 'child_window', strOptions);
		var strHTML;
		strHTML  = '<html><head><title>Bose&#174; ' + strTitle + '</title></head><body marginwidth="10" marginheight="10" leftmargin="10" topmargin="10" alink="#999999" vlink="#666666" bgcolor="#ffffff"><font face="verdana" size="1">';
		strHTML += '<div align="center"><img src="' + strImg + '" /></div>';
		strHTML += '<div align="right"><a title="Inchide fereastra" href="javascript:window.close();"><font color="#000000">Inchide fereastra</font></a></div></font></body></html>';
		objChildWindow.document.open();
		objChildWindow.document.write(strHTML);
		objChildWindow.document.close();
	}
	else {
		doChildWindow(strImg, 'child_window', strOptions);
	}
	//focus the new window
	objChildWindow.focus();
}

//EMAIL NEWS LETTER EMAIL VALIDATE
function checkInputEmail(theForm) {
	if ((theForm.enews.value=="") || (theForm.enews.value.indexOf("@") == -1) || (theForm.enews.value.indexOf(".") == -1)) {
		alert("Please enter a valid email address");
		return false;
	}
	return true;
}

//SEARCH FIELD VALIDATE
function checkInputSearch(theForm) {
	if ((theForm.words) && (theForm.words.value=="")) {
		alert("Please enter your search criteria.");
		return false;
	}
	return true;
}

//PRINT FUNCTION
function doPrint() {
	window.print();
}

//IMAGE PRELOAD
//imgObj - the name of the object associated with the image 
//imgSrc - the source filename (url) of the image
function doPreload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj + ' = new Image()');
		eval(imgObj + '.src = "' + imgSrc + '"');
	}
}

//IMAGE EVENT FUNCTION
//layer - layer name if provided otherwise blank ''
//imgName - name or id of event image
//imgObj -  name or id of the preloaded image object
var glayer;
var gimgName;
var gimgObj;

function imgSwap(layer,imgName,imgObj) {
var layer;
var imgName;
var imgObj;
glayer = layer;
gimgName = imgName;
gimgObj = imgObj;
	if(document.images) {
		//NN 4.x DOM
		if(document.layers && layer != "") {
			eval('document.' + layer + '.document.images["' + imgName + '"].src = ' + imgObj + '.src');
		}
		//NN6 Gecko subroutine
		else if((objClient.application == "nn") && (objClient.version >= 5)) {
			//setTimeout("imgSwapTimeOut()",1);
			imgSwapTimeOut();
		}
		else {
			document.images[imgName].src = eval(imgObj + ".src");
		}
	}
}
//NN Gecko subroutine
function imgSwapTimeOut() {
	document.images[gimgName].src = eval(gimgObj + ".src");
}

//SUBMIT A FORM FUNCTION
//theForm - the name or id of the form to be submitted
//validateFunction - the name of the client side validation function to be called.
function submitForm(theForm, validateFunction) {
	document.forms[theForm].submit();
	if (validateFunction != "") {
		eval(validateFunction + '(' + theForm + ')');
	}
}

//HISTORY NAVIGATION
//i - the place in the history array ( can be a negative | positive number )
function goHistory(i) {
	var i;
	history.go(i);
}

//CONFIRM WINDOW GENERIC
//strMessage - the confirmation message to be displayed
function confirmDialogue(strMessage) {
		if (window.confirm(strMessage)) {
			return true;
		}
	return false;
}

// DISABLE SUBMIT BUTTON ON FORM SUBMISSION
// bFormSubmitted - indicates whether user has already submitted the form
var bFormSubmitted = false;

function disableSubmitButton() {
	if (bFormSubmitted) {
		return false;
	} 
	else {	
		bFormSubmitted = true;
	    return true;
	}
}

//GENERIC COOKIE CHECK
function checkForCookie(strCookieName) {
	
	//get all cookies
	var objAllCookies = document.cookie;

	//does cookie exist?
	var checkPos = objAllCookies.indexOf(strCookieName);
	
	if (checkPos != -1) {
		return true;
	}
	
	return false;
}


function wasClicked1() {
	alert('sdf');
	if(window.event.srcElement.id!=24)
		combo.style.visibility="hidden";
}

function showit1(){
	combo.style.visibility="";
 	combo.style.height=250;
 	combo.style.width=225;
	combo.style.top=buton.offsetTop+23;
	combo.style.left=buton.offsetLeft+8;
}

function cursor(){
	//alert(document.getElementById('Combo'));
	var alege=document.getElementById('alege')
	//alert(alege);
	alege.style.cursor="hand" ;
}

function wasClicked(my) {
				var Combo=document.getElementById('Combo')
				var Contur=document.getElementById('Contur');

					//alert(Combo);
						//cmb.style.visibility="show";
				if(getBrowser()=="ie"){

						if(window.event.srcElement.id!=24){
							Combo.style.visibility="hidden";
							Contur.style.visibility="hidden";
						}

						if(window.event.srcElement.id=="alege"){
							Combo.style.visibility="";
							Contur.style.visibility="";
						}
					}
				}	
function showit(){
		var Combo=document.getElementById('Combo');
		var Contur=document.getElementById('Contur');

		var histo=document.getElementById('histo');
						Combo.style.visibility="";
					 	Combo.style.height=282;
					 	Combo.style.width=223;
						Combo.style.left=histo.offsetLeft+534;
						Combo.style.top=histo.offsetTop+22;
						Contur.style.visibility="";
					 	Contur.style.height=282+2;
					 	Contur.style.width=225;
						Contur.style.top=histo.offsetTop+21;
						Contur.style.left=histo.offsetLeft+533;

					}


function Clicku(e)
{
			var Combo=document.getElementById('Combo')
			var Contur=document.getElementById('Contur');

			if(getBrowser()=="nn"){
				var m=e.target;
				if(m.id!=24){
					Combo.style.visibility="hidden";
					Contur.style.visibility="hidden";

				}
				if(m.id=="alege"||m.id=="Combo"){
					Combo.style.visibility="";
					Contur.style.visibility="";

				}
			}
	
}


document.onmousedown = Clicku;

function getBrowser()
{
	objB=navigator.appName.toLowerCase()
	var strApp;

	if (objB.indexOf("microsoft") != -1)
	{
		strApp = "ie";
	}
	else if (objB.indexOf("netscape") != -1)
	{
		strApp = "nn";
	}
	else
	{
		strApp = "ie";
	}
	return strApp;
}

