function produseRandom() {
	var trim='';
	Ejax('includes/ajax_php/default.php',trim,'produseRand');
	setTimeout('produseRandom()',time);
}
//AJAX STARTS HERE

if (window.location.hash.match(/^#?redir=/)) {
var myregex=/^#?redir=(.+)$/;
var match=myregex.exec(window.location.hash);
if (match[1].match(/^http:/)) {match[1]=window.siteurl+match[1];}
window.location=match[1];
}

var ajax_callback=function () {
	$('#'+this.id+' a[@rel*=lightbox]').lightBox();
	scroll(0,0);
}

function ajax_loadstickysections(ahref) {
	var ajaxlink;
	var sections=['box_categorii','box_topvizualizari'];
	for (var i=0;i<sections.length;i++) {
		if (ahref.match(/\?[^?]*$/)) {ajaxlink=ahref+'&ajax='+sections[i];}
		else {ajaxlink=ahref+'?ajax='+sections[i];}
		if (i==0) {$('#'+sections[i]).prepend("<div class=\"ajaxloading\">Loading...</div>");}
		$('#'+sections[i]).load(ajaxlink,null,ajax_callback);
	}
}

function ajax_sectionformsubmit(form,sections) {
	var ajaxlink;
	var postwhat;
	if (form.method=='get') {
		if (form.action.match(/\?[^?]*$/)) {ajaxlink=form.action+'&ajax='+sections[0]+"&"+$(form).serialize();}
		else {ajaxlink=form.action+'?ajax='+sections[0]+"&"+$(form).serialize();}
		$('#'+sections[0]).prepend("<div class=\"ajaxloading\">Loading...</div>");
		$('#'+sections[0]).load(ajaxlink,null,ajax_callback);
	} else {
		if (form.action.match(/\?[^?]*$/)) {ajaxlink=form.action+'&ajax='+sections[0];}
		else {ajaxlink=form.action+'?ajax='+sections[0];}
		postwhat=$(form).serializeArray();
		$('#'+sections[0]).prepend("<div class=\"ajaxloading\">Loading...</div>");
		$('#'+sections[0]).load(ajaxlink,postwhat,ajax_callback);
	}
	for (var i=1;i<sections.length;i++) {
		if (form.action.match(/\?[^?]*$/)) {ajaxlink=form.action+'&ajax='+sections[i];}
		else {ajaxlink=form.action+'?ajax='+sections[i];}
		if (i==0) {$('#'+sections[i]).prepend("<div class=\"ajaxloading\">Loading...</div>");}
		$('#'+sections[i]).load(ajaxlink,null,ajax_callback);
	}
	ajax_loadstickysections(form.action);
}

function ajax_sectionload(ahref,sections) {
	var ajaxlink;
	for (var i=0;i<sections.length;i++) {
		if (ahref.match(/\?[^?]*$/)) {ajaxlink=ahref+'&ajax='+sections[i];}
		else {ajaxlink=ahref+'?ajax='+sections[i];}
		if (i==0) {$('#'+sections[i]).prepend("<div class=\"ajaxloading\">Loading...</div>");}
		if (sections[i]=='content') {
			var ahref2=ahref;
			if (ahref2.indexOf(window.siteurl)==0) {
				ahref2=ahref2.slice(window.siteurl.length);
			}
			window.location.hash='#redir='+ahref2;
		}
		$('#'+sections[i]).load(ajaxlink,null,ajax_callback);
	}
	ajax_loadstickysections(ahref);
}

//AJAX ENDS HERE








var culoareCosB='';
var p_vizitat=Array();
var zIndexuri=100;

//======[Large Image over image START]=====|
function ShowImage(whatimage){
	init();
	zIndexuri++;
	document.getElementById("mouse_over_"+whatimage).style.display='block';
	document.getElementById("mouse_over_"+whatimage).style.zIndex=zIndexuri;
	if (y_cursor+280 > document.body.scrollHeight ){
		document.getElementById("mouse_over_"+whatimage).style.top=y_cursor-200+'px';
	} else {
		if (y_cursor+400 > document.body.scrollHeight ){
			document.getElementById("mouse_over_"+whatimage).style.top=y_cursor-100+'px';
		} else {
			document.getElementById("mouse_over_"+whatimage).style.top=y_cursor+14+'px';
		}
	}
	document.getElementById("mouse_over_"+whatimage).style.left=x_cursor+14+'px';
}
function HiddeImage(whatimage){
	document.getElementById("mouse_over_"+whatimage).style.display='none';
}
//======[Large Image over image END]=====|

function operatiiCont(t) {
	if (t=='personale') {
		var trim='';
		var redir=$val('tip_redir');
		trim+='nume='+$val('nume');
		trim+='&prenume='+$val('prenume');
		trim+='&dataNasterii='+$val('dataNasterii');
		trim+='&cnp='+$val('cnp');
		trim+='&seria='+$val('seria');
		trim+='&numar='+$val('numar');
		trim+='&adresa='+$val('adresa');
		trim+='&cod_postal='+$val('cod_postal');
		trim+='&oras='+$val('oras');
		trim+='&judet='+$val('judet');
		trim+='&tara='+$val('tara');
		trim+='&telefon='+$val('telefon');
		trim+='&fax='+$val('fax');
		trim+='&tip_pers='+$val('tip_pers');
		trim+='&compania2='+$val('compania2');
		trim+='&cif2='+$val('cif2');
		trim+='&banca2='+$val('banca2');
		trim+='&cont2='+$val('cont2');
		trim+='&regCom2='+$val('regCom2');
		trim+='&tip='+t;
		trim+='&tip_redir='+$val('tip_redir');
		Ejax('includes/ajax_php/operatii_cont.php',trim,'datePersonale');
		if (redir==1) {
			var t=setTimeout("window.location='comanda.html';",3000);
		}
	} else {
		if (t=='email') {
			var trim='';
			trim+='email='+$val('email');
			trim+='&email2='+$val('email2');
			trim+='&tip='+t;
			Ejax('includes/ajax_php/operatii_cont.php',trim,'modificaEmail');
		} else {
			if (t=='parola') {
				var trim='';
				trim+='oldPass='+$val('oldPass');
				trim+='&newPass='+$val('newPass');
				trim+='&newPass2='+$val('newPass2');
				trim+='&tip='+t;
				Ejax('includes/ajax_php/operatii_cont.php',trim,'modificaParola');
			} else {
				if (t=='firma') {
					var trim='';
					trim+='compania='+$val('compania');
					trim+='&cif='+$val('cif');
					trim+='&banca='+$val('banca');
					trim+='&cont='+$val('cont');
					trim+='&regCom='+$val('regCom');
					trim+='&tip='+t;
					Ejax('includes/ajax_php/operatii_cont.php',trim,'modificaFirma');
				}
			}
		}
	}
}
function newsletter() {
	var mail=$val('emailnews');
	if (mail=='') {
		alert('Completeaza adresa de email!');
	} else {
		var trim='';
		trim+='mail='+mail;
		Ejax('includes/ajax_php/newsletter.php',trim,'');
		document.getElementById('emailnews').value='';
	}
}
function filtru_comenzi(v,p) {
	$('#istoricComenzi').load('includes/ajax_php/istoric_comenzi.php?val='+v+'&af_pag='+p);
}
function verDateContact(tip,value) {
	if (tip=='send') {
		var trim='';
		trim+='tip='+tip;
		trim+='&nume='+eurl($val('nume'));
		trim+='&email='+eurl($val('email'));
		trim+='&mesaj='+eurl($val('mesaj'));
		Ejax('includes/ajax_php/ver_date_contact.php',trim,'',function (r) {
			alerta(r);
		});
		document.getElementById('nume').value='';
		document.getElementById('email').value='';
		document.getElementById('mesaj').value='';
		document.getElementById('verNume').innerHTML='';
		document.getElementById('verEmail').innerHTML='';
		document.getElementById('verMesaj').innerHTML='';
	} else {
		var trim='';
		trim+='tip='+tip;
		trim+='&value='+value;
		Ejax('includes/ajax_php/ver_date_contact.php',trim,tip);
	}
}
function recomanda_unui_prieten(tip,val,val2) {
	if (tip=='open') {
		AjaxW('link='+val,window.siteurl+'includes/windows/win_recomanda.php','recomanda_win','Recomanda unui prieten',500,530,0,0,1);
	}
	if (tip=='send') {
		if ($val('nume')=='') {
			document.getElementById('numele').innerHTML="Va rugam completati numele dumneavoastra!";
		} else if ($val('email')=='') {
			document.getElementById('emailul').innerHTML="Va rugam completati emailul dumneavoastra!";
		} else if ($val('emailPrieten')=='') {
			document.getElementById('emailPrietens').innerHTML="Va rugam completati emailul prietenului!";
		} else {
			var trim='';
			trim+='tip='+tip;
			trim+='&link='+val;
			trim+='&nume='+eurl($val('nume'));
			trim+='&email='+eurl($val('email'));
			trim+='&emailPrieten='+eurl($val('emailPrieten'));
			trim+='&numePrieten='+eurl($val('numePrieten'));
			trim+='&mesaj='+eurl($val('mesaj'));
			Ejax(window.siteurl+'includes/ajax_php/recomanda.php',trim,'div_nimic');
			NSS_winClose('recomanda_win');
			alerta ('Mesajul a fost trimis!');
			var timp=setTimeout(function () { close_alerta(); },4000);

		}
	}
}
function am_uitat_parola(tip,val,val2) {
	if (tip=='open') {
	AjaxW('',window.siteurl+'includes/windows/win_am_uitat_parola.php','parola_win','Recuperare parola',500,530,0,0,1);
	}
	if (tip=='send') {
		if ($val('email')=='') {
			document.getElementById('raspuns').innerHTML='<div>Completati corect emailul!</div>';
			} else {
			var trim='';
			trim+='email='+eurl($val('email'));
			Ejax(window.siteurl+'includes/ajax_php/am_uitat_parola.php',trim,'raspuns');
			document.getElementById('email').value='';
		}
	}
}
function newsletter_op(tip,val,val2) {
	if (tip=='open') {
		AjaxW('',window.siteurl+'includes/windows/win_newsletter.php','news_win','Newsletter Gastromed.ro',500,530,0,0,1);
	}
	if (tip=='send') {
		if ($val('email')=='') {
			document.getElementById('raspuns').innerHTML='<div>Completati corect emailul!</div>';
			} else {
			var trim='';
			trim+='email='+eurl($val('email'));
			Ejax(window.siteurl+'includes/ajax_php/newsletter.php',trim,'raspuns');
			document.getElementById('email').value='';
		}
	}
}
function ecografie_op(tip,val,val2) {
	if (tip=='open') {
		AjaxW('',window.siteurl+'includes/windows/win_ecografie.php','news_win','Programare Ecografie Abdominala Bucuresti',500,530,0,0,1);
	}
	if (tip=='send') {
		if ($val('email')==''){
			document.getElementById('raspuns').innerHTML='<div>Completati corect emailul!</div>';
			} else if ($val('nume')=='') {
			document.getElementById('raspuns1').innerHTML='<div>Completati numele!</div>';
			} else if ($val('prenume')=='') {
			document.getElementById('raspuns2').innerHTML='<div>Completati prenumele!</div>';
			} else if ($val('telefon')=='') {
			document.getElementById('raspuns3').innerHTML='<div>Completati telefonul!</div>';
//			} else if ($val('birth_date')=='') {
//			document.getElementById('raspuns4').innerHTML='<div>Completati data nasterii!</div>';
			} else {
			var trim='';
			trim+='email='+eurl($val('email'));
			trim+='&nume='+eurl($val('nume'));
			trim+='&prenume='+eurl($val('prenume'));
			trim+='&telefon='+eurl($val('telefon'));
//			trim+='&birth_date='+eurl($val('birth_date'));
			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns');
			document.getElementById('email').value='';
			document.getElementById('nume').value='';
			document.getElementById('prenume').value='';
			document.getElementById('telefon').value='';
//			document.getElementById('birth_date').value='';
			AjaxW('',window.siteurl+'includes/windows/win_print.php','news_win','Programare Ecografie Abdominala Bucuresti',500,530,0,0,1);		
		}
//		if ($val('nume')=='') {
//			document.getElementById('raspuns1').innerHTML='<div>Completati numele!</div>';
//			} else {
//			var trim='';
//			trim+='nume='+eurl($val('nume'));
//			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns1');
//			document.getElementById('nume').value='';
//		}
//		if ($val('prenume')=='') {
//			document.getElementById('raspuns2').innerHTML='<div>Completati prenumele!</div>';
//			} else {
//			var trim='';
//			trim+='prenume='+eurl($val('prenume'));
//			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns2');
//			document.getElementById('prenume').value='';
//		}
//		if ($val('telefon')=='') {
//			document.getElementById('raspuns3').innerHTML='<div>Completati telefonul!</div>';
//			} else {
//			var trim='';
//			trim+='telefon='+eurl($val('telefon'));
//			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns3');
//			document.getElementById('telefon').value='';
//		}
//		if ($val('birth_date')=='') {
//			document.getElementById('raspuns4').innerHTML='<div>Completati data nasterii!</div>';
//			} else {
//			var trim='';
//			trim+='birth_date='+eurl($val('birth_date'));
//			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns4');
//			document.getElementById('birth_date').value='';
//		}
	}
}
function concurs_op(tip,val,val2) {
	if (tip=='open') {
		AjaxW('',window.siteurl+'includes/windows/win_concurs.php','news_win','Castiga o consultatie si o ecografie abdominala',700,530,0,0,1);
	}
	if (tip=='send') {
		if ($val('email')==''){
			document.getElementById('raspuns').innerHTML='<div style="margin:0 5px;color:#cb1c1c;">Completati corect emailul!</div>';
			} else if ($val('nume')=='') {
			document.getElementById('raspuns1').innerHTML='<div style="margin:0 5px;color:#cb1c1c;">Completati numele!</div>';
			} else if ($val('prenume')=='') {
			document.getElementById('raspuns2').innerHTML='<div style="margin:0 5px;color:#cb1c1c;">Completati prenumele!</div>';
			} else if ($val('telefon')=='') {
			document.getElementById('raspuns3').innerHTML='<div style="margin:0 5px;color:#cb1c1c;">Completati telefonul!</div>';
//			} else if ($val('birth_date')=='') {
//			document.getElementById('raspuns4').innerHTML='<div>Completati data nasterii!</div>';
			} else {
			var trim='';
			trim+='email='+eurl($val('email'));
			trim+='&nume='+eurl($val('nume'));
			trim+='&prenume='+eurl($val('prenume'));
			trim+='&telefon='+eurl($val('telefon'));
			trim+='&rel='+eurl($val('rel'));
			trim+='&question='+eurl($val('question'));
//			trim+='&birth_date='+eurl($val('birth_date'));
			Ejax(window.siteurl+'includes/ajax_php/concurs.php',trim,'raspuns');
			document.getElementById('email').value='';
			document.getElementById('nume').value='';
			document.getElementById('prenume').value='';
			document.getElementById('telefon').value='';
//			document.getElementById('birth_date').value='';
//			AjaxW('',window.siteurl+'includes/windows/win_print.php','news_win','Programare Ecografie Abdominala Bucuresti',500,530,0,0,1);		
		}
//		if ($val('nume')=='') {
//			document.getElementById('raspuns1').innerHTML='<div>Completati numele!</div>';
//			} else {
//			var trim='';
//			trim+='nume='+eurl($val('nume'));
//			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns1');
//			document.getElementById('nume').value='';
//		}
//		if ($val('prenume')=='') {
//			document.getElementById('raspuns2').innerHTML='<div>Completati prenumele!</div>';
//			} else {
//			var trim='';
//			trim+='prenume='+eurl($val('prenume'));
//			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns2');
//			document.getElementById('prenume').value='';
//		}
//		if ($val('telefon')=='') {
//			document.getElementById('raspuns3').innerHTML='<div>Completati telefonul!</div>';
//			} else {
//			var trim='';
//			trim+='telefon='+eurl($val('telefon'));
//			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns3');
//			document.getElementById('telefon').value='';
//		}
//		if ($val('birth_date')=='') {
//			document.getElementById('raspuns4').innerHTML='<div>Completati data nasterii!</div>';
//			} else {
//			var trim='';
//			trim+='birth_date='+eurl($val('birth_date'));
//			Ejax(window.siteurl+'includes/ajax_php/ecografie.php',trim,'raspuns4');
//			document.getElementById('birth_date').value='';
//		}
	}
}

