function openConfigurator() {
	var width = 850;
	var height = 700;
	var printw = window.open('configurator.php',"configw",'width='+width+',height='+height+',left='+(screen.availWidth - width)/2+',top='+(screen.availHeight - height)/2+',toolbar=no,menubar=no,status=no,resizable=yes');
	
}

function checkTDForm() {
	name = document.getElementById('nume');
	surname = document.getElementById('prenume');
	oras = document.getElementById('oras');
	email = document.getElementById('email');
	mobil = document.getElementById('mobil');
	tel = document.getElementById('tel');
	rg2 = document.getElementById('rg2');
	model = document.getElementById('model');
	if (name.value=='' || surname.value=='' || oras.value == '' || email.value=='' || mobil.value==''|| tel.value==''|| rg2.value==''|| model.value=='') {
		alert('Completati toate campurile marcate cu *.');
		return false;
	}
	if (!checkEmailValid(email.value)) {		
		alert('Introduceti o adresa de email Valida!');
		email.focus();
		return false;
	}
	
	return true;
	
}

function checkEmailValid(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){		   
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){		    
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}

function getMouseX(ev) {
  if (ev.pageX) return ev.pageX;
  else if (ev.clientX) return ev.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft);
  else return null;
}
function getMouseY(ev) {
  if (ev.pageY) return ev.pageY;
  else if (ev.clientY) return ev.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
  else return null;
}
function ToolTip(ev,id) {
  if (document.getElementById) div=document.getElementById(id);
  else if (document.all) div=document.all[id];
  else return;
  if ((div.style.visibility == "visible" || div.style.visibility == "show") || div.innerHTML=='dasdasdas') {
    div.style.visibility = "hidden";
  } else {
    div.style.left = getMouseX(ev)+10+'px';
    div.style.top = getMouseY(ev)-30+'px';
    div.style.visibility = "visible";
  }
}
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
		  if (document[changeImages.arguments[i]])
			 document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
function showPicture(pic, width, height) {
  wind=window.open(pic,"picture",'width='+width+',height='+height+',left='+(screen.availWidth - width)/2+',top='+(screen.availHeight - height)/2+',toolbar=no,menubar=no,status=no,resizable=yes');
	//wind.document.open()
	var content=''
	content+='<html><body style="overflow: hidden; " onload=\'this.focus()\' BGCOLOR="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">\n'
	content+='<a href="javascript:window.close();"><img src="' + pic + '" border="0" /></a>\n'
	content+='</body></html>\n'
	wind.document.write(content)	
	//wind.document.close()
}

function printDiv(divID, width, height)
{
	var content='';
	//content = document.getElementById(divID).innerHTML;
	var printw = window.open('print.html',"printw",'width='+width+',height='+height+',left='+(screen.availWidth - width)/2+',top='+(screen.availHeight - height)/2+',toolbar=no,menubar=no,status=no,resizable=yes');	
	//printw.document.getElementById('content_body_text').innerHTML = content;
	//alert(printw.document.getElementById('content_body_text'));
	//printw.print();
}

/*
Pausing updown message scroller- 
? Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
Terms Of Use, visit http://www.dynamicdrive.com
midified by sly@makolab.pl
*/
	  var scrollerwidth='200px';
	  var scrollerheight='60px';
	  var scrollertop = '5px';
	  var scrollerleft = '5px';
	  var scrollerbgcolor=''; 
	var ie = document.all;
	var dom = document.getElementById;
	var ns = document.layers;
	var tick_i=0;
	if (typeof(tickers) != 'undefined' && tickers.length>2) {
		tick_i=2;
	}
	else {
		tick_i=0;
	}
	function move3(whichdiv) {
		tdiv=eval(whichdiv);
		if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5) {
			tdiv.style.top=0+"px";
			setTimeout("move3(tdiv)",3000);
			setTimeout("move4(second2_obj)",3000);
			return;
		}
		if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1) {
			tdiv.style.top=parseInt(tdiv.style.top)-5+"px";
			setTimeout("move3(tdiv)",50);
		}
		else {
			tdiv.style.top=scrollerheight;
			tdiv.innerHTML=tickers[tick_i];
			if (tick_i==tickers.length-1) {
				tick_i=0;
			}
			else {
				tick_i++;
			}
		}
	}
	function move4(whichdiv) {
		tdiv2=eval(whichdiv);
		if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5) {
			tdiv2.style.top=0+"px";
			setTimeout("move4(tdiv2)",3000);
			setTimeout("move3(first2_obj)",3000);
			return;
		}
		if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1) {
			tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px";
			setTimeout("move4(second2_obj)",50);
		}
		else {
			tdiv2.style.top=scrollerheight;
			tdiv2.innerHTML=tickers[tick_i];
			if (tick_i==tickers.length-1) {
				tick_i=0;
			}
			else {
				tick_i++;
			}
		}
	}
	function startscroll() {
		if (!document.layers) {
			if (tickers.length>2) {
				tick_i=2;
			}
			else {
				tick_i=0;
			}
			if (ie||dom) {
				first2_obj=ie? first2 : document.getElementById("first2");
				second2_obj=ie? second2 : document.getElementById("second2");
				move3(first2_obj);
				second2_obj.style.top=scrollerheight;
				second2_obj.style.visibility='visible';
			}
			else if (ns) {
				document.main.visibility='show';
				move1(document.main.document.first);
				document.main.document.second.top=parseInt(scrollerheight)+5;
				document.main.document.second.visibility='show';
			}
		}
	}
  function writeTickers() {
  	if (ie||dom) {
  		document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+';top:'+scrollertop+';left:'+scrollerleft+';">');
  		document.writeln('	<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">');
  		document.writeln('		<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:1px;">');
  		document.write(					tickers[0]);
  		document.writeln('		</div>');
  		document.writeln('		<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px;visibility:hidden">');
  		document.write(					tickers[dyndetermine=(tickers.length==1)? 0 : 1]);
  		document.writeln('		</div>');
  		document.writeln('	</div>');
  		document.writeln('</div>');
  	}
  }

