// functions.js
function runajax(objID, serverPage)
{
//Create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp = false;
//Check if we are using IE.
try {
//If the JavaScript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older ActiveX object.
try {
//If we are using Internet Explorer.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
// If we are not using IE, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
var obj = document.getElementById(objID);
obj.innerHTML='<img src="ajax-loader.gif" />';
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;

}
}
xmlhttp.send(null);
}



function runajaxpost(objID, serverPage)
{
var xmlhttp = false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
var obj = document.getElementById(objID);
xmlhttp.open("POST", serverPage,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(serverPage);
}

function isValidEmail(str) {
   var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
   if (!filter.test(str)) return false;
   else return true;
}

function verificafeedback() {
var eroare = false;
var x = document.getElementById('feedbacksubiect');
if (x.value=="") { eroare=true; alert("Alege sau scrie un subiect"); }
var x = document.getElementById('feedbackcontent');
if (x.value=="") { eroare=true; alert("Mesajul trebuie sa aibe un continut"); }
if (eroare==false) document.forms["feedbackform"].submit();
}

function verificare() {
	var eroare = false;
	var x = document.getElementById('contname');
	var y = document.getElementById('spanname');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (x.value.match(" ")) { y.className="rosu"; eroare = true; }
		 else y.className="negru";
	
	
	x = document.getElementById('contsurname');
	y = document.getElementById('spansurname');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (x.value.match(" ")) { y.className="rosu"; eroare = true; }
		 else y.className="negru";
	
	
	x = document.getElementById('conttel');
	y = document.getElementById('spantel');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (isNaN(x.value)) { y.className="rosu"; eroare = true; }
		 else if (x.value.length!=10) { y.className="rosu"; eroare = true; }
		 	  else if (x.value.substring(0,2)!='07') { y.className="rosu"; eroare = true; }
			 	   else y.className="negru";
	
	p1notblank=false;
	p2notblank=false;
	x = document.getElementById('contpass');
	y = document.getElementById('spanpass');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else { y.className="negru"; p1notblank=true; }
	
	x2 = document.getElementById('contpass2');
	y2 = document.getElementById('spanpass2');
	if (x2.value=="") { y2.className="rosu"; eroare = true; }
	else { y2.className="negru"; p2notblank=true; }
	
	if (p1notblank && p2notblank) {
		if (x.value!=x2.value) { y.className="rosu"; y2.className="rosu"; eroare=true }
		else { y.className="negru"; y2.className="negru"; }
	}
	
//	x = document.getElementById('contemail');
//	y = document.getElementById('spanemail');
//	if (x.value=="") { y.className="rosu"; eroare = true; }
//	else if (!isValidEmail(x.value)) { y.className="rosu"; eroare = true; }
//		 else y.className="negru";
	
	x = document.getElementById('contcaptcha');
	y = document.getElementById('spancaptcha');
	z = document.getElementById('contresult');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (x.value!=z.value) { y.className="rosu"; eroare = true; }
		 else y.className="negru";
	if (!eroare) x=document.forms['contnou'].submit();
}

function verificareedit() {
	var eroare = false;
	var x = document.getElementById('contname');
	var y = document.getElementById('spanname');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (x.value.match(" ")) { y.className="rosu"; eroare = true; }
		 else y.className="negru";
	
	
	x = document.getElementById('contsurname');
	y = document.getElementById('spansurname');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (x.value.match(" ")) { y.className="rosu"; eroare = true; }
		 else y.className="negru";
	
	
	x = document.getElementById('conttel');
	y = document.getElementById('spantel');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (isNaN(x.value)) { y.className="rosu"; eroare = true; }
		 else if (x.value.length!=10) { y.className="rosu"; eroare = true; }
		 	  else if (x.value.substring(0,2)!='07') { y.className="rosu"; eroare = true; }
			 	   else y.className="negru";

	x = document.getElementById('conttel2');
	y = document.getElementById('spantel2');
	if (x.value!="") {
		if (isNaN(x.value)) { y.className="rosu"; eroare = true; }
			else if (x.value.length!=10) { y.className="rosu"; eroare = true; }
		 		else if (x.value.substring(0,2)!='07') { y.className="rosu"; eroare = true; }
					else y.className="negru";
	}
	else y.className="negru";
	
	p1notblank=false;
	p2notblank=false;
	var old = document.getElementById('contpassold');
	var old2 = document.getElementById('spanpassold');
	x = document.getElementById('contpass');
	y = document.getElementById('spanpass');
	x2 = document.getElementById('contpass2');
	y2 = document.getElementById('spanpass2');
	if (old.value!="") {
		old2.className="negru";	
		if (x.value=="") { y.className="rosu"; eroare = true; }
		else { y.className="negru"; p1notblank=true; }

		if (x2.value=="") { y2.className="rosu"; eroare = true; }
		else { y2.className="negru"; p2notblank=true; }
		
		if (p1notblank && p2notblank) {
			if (x.value!=x2.value) { y.className="rosu"; y2.className="rosu"; eroare=true; }
			else { y.className="negru"; y2.className="negru"; }
		}
	}
	else if (x.value!="" && x2.value!="") { old2.className="rosu"; eroare=true; }
	else {	old2.className="negru";		
		}
	
	x = document.getElementById('contemail');
	y = document.getElementById('spanemail');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (!isValidEmail(x.value)) { y.className="rosu"; eroare = true; }
		 else y.className="negru";
	
	if (!eroare) x=document.forms['contnou'].submit();
}

function getlocalitati(judet,localitateid) {
	url = 'getajaxlocalitati.php?judet='+judet+'&localitateid='+localitateid;
	runajax('divlocalitati', url);
}



function populate1(ce) {
var x;
var y;
if (ce=="localitati") {
	x=document.getElementById('comanda4');
	x.disabled=true;
	newImage = "url(http://www.hailapeste.ro/images/butoncmicad.png)";
        x.style.backgroundImage = newImage;
	x=document.getElementById('label');
	x.value="";
	x=document.getElementById('aiales');
	x.innerHTML="&nbsp;";
	x = document.getElementById('judete');
	url = 'getajaxlocalitatisolunar.php?judet='+x.value;
	runajax('solunar4localitati',url);
	//alert(x.options[x.selectedIndex].text) = textul selectat
	}
	if (ce=="luni") {
	x=document.getElementById('comanda4');
	x.disabled=true;
	newImage = "url(http://www.hailapeste.ro/images/butoncmicad.png)";
        x.style.backgroundImage = newImage;
	x=document.getElementById('label');
	x.value="";
	x=document.getElementById('aiales');
	x.innerHTML="&nbsp;";
	x=document.getElementById('solunar4luni');
	x.innerHTML='<select  id="luni" name="luni" size="12" onchange="populate1(\'okbutton\');"><option value="1" disabled="disabled">Ianuarie</option><option value="2">Februarie</option><option value="3">Martie</option><option value="4">Aprilie</option><option value="5">Mai</option><option value="6">Iunie</option><option value="7">Iulie</option><option value="8">August</option><option value="9">Septembrie</option><option value="10">Octombrie</option><option value="11">Noiembrie</option><option value="12">Decembrie</option></select>';
	}
	if (ce=="okbutton") {
	var str = "Autentifica-te acum pentru a vizualiza si apoi a descarca din contul tau un solunar profesional calculat special pentru zona ";	
	var str2= '';
	x = document.getElementById('localitateid');
	var locnume = x.options[x.selectedIndex].text;
	var locid = x.options[x.selectedIndex].value;
	
	x = document.getElementById('judete');
	var judnume = x.options[x.selectedIndex].text;
	var judid = x.options[x.selectedIndex].value;
	
	x = document.getElementById('luni');
	var lunanume = x.options[x.selectedIndex].text;
	var lunaid = x.options[x.selectedIndex].value;
	
	var curDate = new Date();
	var curYear = curDate.getFullYear();
	var scurYear = curYear.toString().slice(2);
	str += locnume + ', jud. '+ judnume + ', pe luna ' + lunanume + ' ' +curYear+'.';
	str2 += judid + '-' + locid + '-' +lunaid + '-' +scurYear;
	x=document.getElementById('aiales');
	x.innerHTML=str;
	x=document.getElementById('comanda4');
	if (checksolunar4()==true) { 
		y=document.getElementById('label'); 
		y.value=str2;
        x.style.backgroundColor = '#009000';
        x.style.color = '#FFFFFF';
        x.style.backgroundImage = '';
		x.disabled=false; 
		}
	}
}

function populatep(ce) {
var x;
var y;
if (ce=="plocalitati") {
	x=document.getElementById('comanda4');
	x.disabled=true;
	newImage = "url(http://www.hailapeste.ro/images/butoncmicad.png)";
        x.style.backgroundImage = newImage;
        x.style.color = '#000000';
	x=document.getElementById('plabel');
	x.value="";
	x=document.getElementById('paiales');
	x.style.display='block';
	x.innerHTML="&nbsp;";
	x = document.getElementById('pjudete');
	url = 'getajaxlocalitatisolunar.php?judet='+x.value+'&p=1';
	runajax('psolunar4localitati',url);
	//alert(x.options[x.selectedIndex].text) = textul selectat
	}
	if (ce=="pluni") {
	x=document.getElementById('comanda4');
	x.disabled=true;
	newImage = "url(http://www.hailapeste.ro/images/butoncmicad.png)";
        x.style.backgroundImage = newImage;
        x.style.color = '#000000';
	x=document.getElementById('plabel');
	x.value="";
	x=document.getElementById('paiales');
	x.innerHTML="&nbsp;";
	x=document.getElementById('psolunar4luni');
	x.innerHTML='<select  id="pluni" name="pluni" size="12" onchange="populatep(\'pokbutton\');"><option value="1" disabled="disabled">Ianuarie</option><option value="2">Februarie</option><option value="3">Martie</option><option value="4">Aprilie</option><option value="5">Mai</option><option value="6">Iunie</option><option value="7">Iulie</option><option value="8">August</option><option value="9">Septembrie</option><option value="10">Octombrie</option><option value="11">Noiembrie</option><option value="12">Decembrie</option></select>';
	}
	if (ce=="pokbutton") {
	var str = "Autentifica-te acum pentru a vizualiza si apoi a descarca din contul tau un solunar profesional calculat special pentru locul ";	
	var str2= '';
	x = document.getElementById('plocalitateid');
	var locnume = x.options[x.selectedIndex].text;
	var locid = x.options[x.selectedIndex].value;
	
	x = document.getElementById('pjudete');
	var judnume = x.options[x.selectedIndex].text;
	var judid = x.options[x.selectedIndex].value;
	
	x = document.getElementById('pluni');
	var lunanume = x.options[x.selectedIndex].text;
	var lunaid = x.options[x.selectedIndex].value;
	
	var curDate = new Date();
	var curYear = curDate.getFullYear();
	var scurYear = curYear.toString().slice(2);
	str += locnume + ', jud. '+ judnume + ', pe luna ' + lunanume + ' ' +curYear+'.';
	str2 += judid + '-' + locid + '-' +lunaid + '-' +scurYear;
	x=document.getElementById('paiales');
	x.style.display='block';
	x.innerHTML=str;
	x=document.getElementById('comanda4');
	if (checksolunar4()==true) { 
		var p1 = document.getElementById('plocalitateid').value;
		var p2 = document.getElementById('pjudete').value;
		var p3 = document.getElementById('pluni').value;
		
		var s1 = document.getElementById('localitateid').value;
		var s2 = document.getElementById('judete').value;
		var s3 = document.getElementById('luni').value;
		
		if (p3 !== s3)
		{
			y=document.getElementById('plabel'); 
			y.value=str2;
			newImage = "url(http://www.hailapeste.ro/images/butoncmica.png)";
	        x.style.backgroundImage = newImage;
			x.disabled=false; 
		}
		else 
		{
			newImage = "url(http://www.hailapeste.ro/images/butoncmicad.png)";
	        x.style.backgroundImage = newImage;
	        x.style.color = '#000000';
			alert('Pentru profit maxim, alege solunare pe luni diferite');
			x.disabled=true;
		}
		}
	}
}

function verificas4() {
var	y=document.getElementById('label');
if (y.value=="") alert("Alege un judet, o localitate si o luna pentru a putea comanda un solunar");
else document.forms["solunar4"].submit();
}
function submitSolunar(){
	new Ajax.Request('/ajax_login.php', {
	  onSuccess: function(response) {
			if(response.responseText=='1'){
				var	y=document.getElementById('label');
				if (y.value=="") alert("Alege un judet, o localitate si o luna pentru a putea comanda un solunar");
				else document.forms["solunar4"].submit();
			}else{
				
				return GB_showCenter('Login Hailapeste', 'http://'+window.location.hostname+'/login_box.php')
			}
	      // yada yada yada
	  }
	});
	
	return false;

	
}
function submitSolunar1(){
	new Ajax.Request('/ajax_login.php', {
	  onSuccess: function(response) {
			if(response.responseText=='1'){
				verificas7();
			}else{
				return GB_showCenter('Login Hailapeste', 'http://'+window.location.hostname+'/login_box.php')
			}
	      // yada yada yada
	  }
	});
	
	return false;

	
}



function verificas7() {
var submitare = true;
var	y=document.getElementById('label1');
if (y.value=="") { alert("Alege un judet, o localitate si o luna pentru a putea comanda un solunar"); submitare=false; }
var	y=document.getElementById('label2');
if (y.value=="") { alert("Alege un judet, o localitate si o luna pentru a putea comanda un solunar"); submitare=false; }
var	y=document.getElementById('label3');
if (y.value=="") { alert("Alege un judet, o localitate si o luna pentru a putea comanda un solunar"); submitare=false; }
if (submitare==true) document.forms["solunar7"].submit();
}

function populate(ce,nr) {
	var x;
	if (ce=="localitati") {
	x=document.getElementById('comanda7');
	x.disabled=true;
	newImage = "url(http://www.hailapeste.ro/images/butoncmared.png)";
        x.style.backgroundImage = newImage;
	x=document.getElementById('label'+nr);
	x.value="";
	x=document.getElementById('aiales'+nr);
	x.innerHTML="&nbsp;";
	x = document.getElementById('judete'+nr);
	url = 'getajaxlocalitatisolunar.php?judet='+x.value+'&ce='+nr;
	runajax('solunar7localitati'+nr,url);
	//alert(x.options[x.selectedIndex].text) = textul selectat
	}
	if (ce=="luni") {
	x=document.getElementById('comanda7');
	x.disabled=true;
	newImage = "url(http://www.hailapeste.ro/images/butoncmared.png)";
        x.style.backgroundImage = newImage;
	x=document.getElementById('label'+nr);
	x.value="";
	x=document.getElementById('aiales'+nr);
	x.innerHTML="&nbsp;";
	x=document.getElementById('solunar7luni'+nr);
	x.innerHTML='<select  id="luni'+nr+'" name="luni'+nr+'" size="12" onchange="populate(\'okbutton\',\''+nr+'\');"><option value="1" disabled="disabled">Ianuarie</option><option value="2">Februarie</option><option value="3">Martie</option><option value="4">Aprilie</option><option value="5">Mai</option><option value="6">Iunie</option><option value="7">Iulie</option><option value="8">August</option><option value="9">Septembrie</option><option value="10">Octombrie</option><option value="11">Noiembrie</option><option value="12">Decembrie</option></select>';
	}
	if (ce=="okbutton") {
	var str = "Autentifica-te acum din contul tau pentru a avea acces in mai putin de 24 de ore la acest solunar profesional ce va fi special calculat pentru localitatea ";	
	var str2= '';
	x = document.getElementById('localitateid'+nr);
	var locnume = x.options[x.selectedIndex].text;
	var locid = x.options[x.selectedIndex].value;
	
	x = document.getElementById('judete'+nr);
	var judnume = x.options[x.selectedIndex].text;
	var judid = x.options[x.selectedIndex].value;
	
	x = document.getElementById('luni'+nr);
	var lunanume = x.options[x.selectedIndex].text;
	var lunaid = x.options[x.selectedIndex].value;
	
	var curDate = new Date();
	var curYear = curDate.getFullYear();
	var scurYear = curYear.toString().slice(2);
	str += locnume + ', jud. '+ judnume + ', pe luna ' + lunanume + ' ' +curYear+'.';
	str2 += judid + '-' + locid + '-' +lunaid + '-' +scurYear;
	x=document.getElementById('aiales'+nr);
	x.innerHTML=str;
	x=document.getElementById('comanda7');
	y=document.getElementById('label'+nr); 
	y.value=str2; 
	if (checksolunar7()==true) { 
		x.disabled=false; 
		newImage = "url(http://www.hailapeste.ro/images/butoncmare.png)";
        x.style.backgroundImage = '';
        x.style.background="#B30900";
        x.style.color="#FFFFFF";
        
		}
	}
}

function checksolunar4() {
var ok = true;
var x = document.getElementById('judete');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('localitateid');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('luni');
if (x.selectedIndex=='-1') ok=false;
if (document.getElementById('pjudete'))
{
	var x = document.getElementById('pjudete');
	if (x.selectedIndex=='-1') ok=false;
	var x = document.getElementById('plocalitateid');
	if (x.selectedIndex=='-1') ok=false;
	var x = document.getElementById('pluni');
	if (x.selectedIndex=='-1') ok=false;
}
if (ok==true) return true;
else return false;
}

function checksolunar7() {
var ok = true;
var x = document.getElementById('judete1');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('judete2');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('judete3');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('localitateid1');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('localitateid2');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('localitateid3');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('luni1');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('luni2');
if (x.selectedIndex=='-1') ok=false;
var x = document.getElementById('luni3');
if (x.selectedIndex=='-1') ok=false;
if (ok==true) return true;
else return false;
}
/*
	Editable select
	Copyright (C) September 2005  DTHMLGoodies.com, Alf Magne Kalleland
	
	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.
	
	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
	
	Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
	written by Alf Magne Kalleland.
	
	Alf Magne Kalleland, 2006
	Owner of DHTMLgoodies.com
		
	************************************************************************************************************/	

	
	// Path to arrow images
	var arrowImage = './images/select_arrow.gif';	// Regular arrow
	var arrowImageOver = './images/select_arrow_over.gif';	// Mouse over
	var arrowImageDown = './images/select_arrow_down.gif';	// Mouse down

	
	var selectBoxIds = 0;
	var currentlyOpenedOptionBox = false;
	var editableSelect_activeArrow = false;
	

	
	function selectBox_switchImageUrl()
	{
		if(this.src.indexOf(arrowImage)>=0){
			this.src = this.src.replace(arrowImage,arrowImageOver);	
		}else{
			this.src = this.src.replace(arrowImageOver,arrowImage);
		}
		
		
	}
	
	function selectBox_showOptions()
	{
		if(editableSelect_activeArrow && editableSelect_activeArrow!=this){
			editableSelect_activeArrow.src = arrowImage;
			
		}
		editableSelect_activeArrow = this;
		
		var numId = this.id.replace(/[^\d]/g,'');
		var optionDiv = document.getElementById('selectBoxOptions' + numId);
		if(optionDiv.style.display=='block'){
			optionDiv.style.display='none';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId).style.display='none';
			this.src = arrowImageOver;	
		}else{			
			optionDiv.style.display='block';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId).style.display='block';
			this.src = arrowImageDown;	
			if(currentlyOpenedOptionBox && currentlyOpenedOptionBox!=optionDiv)currentlyOpenedOptionBox.style.display='none';	
			currentlyOpenedOptionBox= optionDiv;			
		}
	}
	
	function selectOptionValue()
	{
		var parentNode = this.parentNode.parentNode;
		var textInput = parentNode.getElementsByTagName('INPUT')[0];
		textInput.value = this.innerHTML;	
		this.parentNode.style.display='none';	
		document.getElementById('arrowSelectBox' + parentNode.id.replace(/[^\d]/g,'')).src = arrowImageOver;
		
		if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + parentNode.id.replace(/[^\d]/g,'')).style.display='none';
		
	}
	var activeOption;
	function highlightSelectBoxOption()
	{
		if(this.style.backgroundColor=='#316AC5'){
			this.style.backgroundColor='';
			this.style.color='';
		}else{
			this.style.backgroundColor='#316AC5';
			this.style.color='#FFF';			
		}	
		
		if(activeOption){
			activeOption.style.backgroundColor='';
			activeOption.style.color='';			
		}
		activeOption = this;
		
	}
	
	function createEditableSelect(dest)
	{

		dest.className='selectBoxInput';		
		var div = document.createElement('DIV');
		div.style.styleFloat = 'left';
		div.style.width = dest.offsetWidth + 16 + 'px';
		div.style.position = 'relative';
		div.id = 'selectBox' + selectBoxIds;
		var parent = dest.parentNode;
		parent.insertBefore(div,dest);
		div.appendChild(dest);	
		div.className='selectBox';
		div.style.zIndex = 10000 - selectBoxIds;

		var img = document.createElement('IMG');
		img.src = arrowImage;
		img.className = 'selectBoxArrow';
		
		img.onmouseover = selectBox_switchImageUrl;
		img.onmouseout = selectBox_switchImageUrl;
		img.onclick = selectBox_showOptions;
		img.id = 'arrowSelectBox' + selectBoxIds;

		div.appendChild(img);
		
		var optionDiv = document.createElement('DIV');
		optionDiv.id = 'selectBoxOptions' + selectBoxIds;
		optionDiv.className='selectBoxOptionContainer';
		optionDiv.style.width = div.offsetWidth-2 + 'px';
		div.appendChild(optionDiv);
		
		if(navigator.userAgent.indexOf('MSIE')>=0){
			var iframe = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			iframe.style.width = optionDiv.style.width;
			iframe.style.height = optionDiv.offsetHeight + 'px';
			iframe.style.display='none';
			iframe.id = 'selectBoxIframe' + selectBoxIds;
			div.appendChild(iframe);
		}
		
		if(dest.getAttribute('selectBoxOptions')){
			var options = dest.getAttribute('selectBoxOptions').split(';');
			var optionsTotalHeight = 0;
			var optionArray = new Array();
			for(var no=0;no<options.length;no++){
				var anOption = document.createElement('DIV');
				anOption.innerHTML = options[no];
				anOption.className='selectBoxAnOption';
				anOption.onclick = selectOptionValue;
				anOption.style.width = optionDiv.style.width.replace('px','') - 2 + 'px'; 
				anOption.onmouseover = highlightSelectBoxOption;
				optionDiv.appendChild(anOption);	
				optionsTotalHeight = optionsTotalHeight + anOption.offsetHeight;
				optionArray.push(anOption);
			}
			if(optionsTotalHeight > optionDiv.offsetHeight){				
				for(var no=0;no<optionArray.length;no++){
					optionArray[no].style.width = optionDiv.style.width.replace('px','') - 22 + 'px'; 	
				}	
			}		
			optionDiv.style.display='none';
			optionDiv.style.visibility='visible';
		}
		
		selectBoxIds = selectBoxIds + 1;
	}
	
function makeSelectText() {
setTimeout("createEditableSelect(document.forms[0].feedbacksubiect)",500);	
}



function checkrecover() {
var eroare=false;
x = document.getElementById('tel');
	y = document.getElementById('spantel');
	if (x.value=="") { y.className="rosu"; eroare = true; }
	else if (isNaN(x.value)) { y.className="rosu"; eroare = true; }
		 else if (x.value.length!=10) { y.className="rosu"; eroare = true; }
		 	  else if (x.value.substring(0,2)!='07') { y.className="rosu"; eroare = true; }
			 	   else y.className="negru";	
if (!eroare) document.forms['resetpass'].submit();
}

function checkCodPromo()
{
	var cod = document.getElementById('codPromo').value
	url = 'getajaxjudete.php?codPromo='+cod;
	runajax('ttt_xxx',url);
}
