').append($('').attr('id',$(this).attr('name')+'__fake')).append($('')));
$(this).bind('change', function() {
$('#'+$(this).attr('name')+'__fake').val($(this).val());
});
$(this).bind('mouseout', function() {
$('#'+$(this).attr('name')+'__fake').val($(this).val());
});
});
$("a[rel='external']").click(function(){
this.target = "_blank";
});
$.get(BASEHREF+"includes/token.php",function(txt){
$("#validation").val(''+txt+'');
});
$('#headerNav li').each(function(){
var t=this;
$(t).append('');
$(t).css('width',$('#headerNav li:eq('+$(t).index()+') > a').width()+2);
});
$("#headerNav li:not(.active)").hover(
function() {
var e = this;
$(e).find("a").stop().animate({ marginTop: "-14px" }, 250, function() { $(e).find("a").animate({ marginTop: "-10px" }, 250); });
$(e).find("img").stop().animate({ width: "80%", height: "25px", marginLeft: '10%', opacity: 0.25 }, 250);
},
function(){
var e = this;
$(e).find("a").stop().animate({ marginTop: "4px" }, 250, function() { $(e).find("a").animate({ marginTop: "0px" }, 250); });
$(e).find("img").stop().animate({ width: "100%", height: "34px", marginLeft: "0px", opacity: 1 }, 250);
});
$("#stars-wrapper1").stars({
inputType: "select",
oneVoteOnly: true,
split: 4,
captionEl: $("#stars-cap"),
callback: function(ui, type, value){
$('#reviews').load(BASEHREF+'content/ajax/rating.php?id_prod='+id_prod+'&id_value='+value);
}
});
$('.btn').each(function(){
if ($(this).attr('rel')!='executed') {
if($.browser.msie && $.browser.version=='6.0'){
$(this).attr('class','ieBtn');
} else {
var htmlStr = $(this).html();
if (htmlStr.indexOf('') == -1) $(this).append('').wrapInner(document.createElement('span')).prepend('');
var rel=$(this).attr('title');
if (rel) {
if ($(this).attr('id')=='reset') $(this).click(function(){ $('#'+rel).find('input[type!=submit], input[type!=reset], textarea').val(''); });
else $(this).click(function(){ $('#'+rel).submit(); });
}
}
} else {
$(this).click(function(){ $('#'+$(this).attr('title')).submit(); });
}
});
$('.ui-widget-overlay').css("z-index","10001");
$('.ui-dialog').css("z-index","10002");
$("input").attr('autocomplete', 'off');
$("body").append("");
});
if (window.location=='http://tgihale.com/') {
window.location=window.siteurl;
}
function eurl(v) {
return encodeURIComponent(v);
}
function refreshShopcart() {
var trim2='';
trim2+='oper=ajax';
EjaxCb(window.siteurl+'content/ajax/shopcart_box.php',trim2,'',function (r) {
$html('shopcartBoxContent',r);
});
}
var order_trim_add='';
var order_trim_id_method=0;
function shopcart_order(type,val,val2) {
order_trim_add='&from_order=1&id_method='+order_trim_id_method;
shopcart(type,val,val2);
}
function select_shipping_method(id_method) {
order_trim_id_method=id_method;
$("#order_total").load(BASEHREF+"content/ajax/order_total.php?id_method="+id_method);
}
function shopcart(type,val,val2) {
if (type=='add') {
var trim='';
trim+='type='+type;
trim+='&id='+val;
trim+='&quant='+val2;
Ejax(window.siteurl+'content/ajax/shopcart.php',trim+order_trim_add,'shopcartContent');
}
if (type=='del') {
if ($val('quantity_'+val)==1) {
if (confirm('Esti sigur ca vrei sa stergi ca vrei sa stergi produsul?')) {
var trim='';
trim+='type='+type;
trim+='&id='+val;
trim+='&quant='+val2;
Ejax(window.siteurl+'content/ajax/shopcart.php',trim+order_trim_add,'shopcartContent');
}
} else {
var trim='';
trim+='type='+type;
trim+='&id='+val;
trim+='&quant='+val2;
Ejax(window.siteurl+'content/ajax/shopcart.php',trim+order_trim_add,'shopcartContent');
}
}
}
function Ejax(phpfile,params,divelem){
EjaxCb(phpfile,params,divelem);
}
function alerta(mesaj, error_var, width) {
if (error_var == null) error_var = false;
if (width == null) width = 642;
options={
'modal' :true,
'width' :width,
'minWidth' :642,
'title' :'Mesaj atentionare!'
};
var mesaj_new="";
if (error_var) {
mesaj_new="
" + mesaj + "
";
} else {
mesaj_new="
" + mesaj + "
";
}
do_win(mesaj_new,options);
}
function do_win(mesaj,options,callback) {
if ($("#window_alerta").dialog('isOpen')!=undefined) $("#window_alerta").dialog('destroy');
$("#window_alerta").html(mesaj);
$("#window_alerta").dialog( options);
if(callback!=null) callback();
}
function confirma(title,mesaj,button,callback) {
options={
'modal' :true,
'width' :240,
'buttons': { " Renunta ": function() { $(this).dialog("close"); } , " Confirma " : function() { callback(); $(this).dialog("close"); } },
'title' : title
};
do_win(mesaj,options);
}
function error(mesaj) {
alerta(mesaj, true);
}
function $val(a){
try{
return document.getElementById(a).value;
}
catch(e){
alert('Elementul '+a+' nu poate fi gasit reporniti browserul si incercati din nou');
return false;
}
}
function $v(a,v){
try{
document.getElementById(a).value=v;
return true;
}
catch(e){
alert('Elementul '+a+' nu poate fi gasit reporniti browserul si incercati din nou');
return false;
}
}
function $html(a,v){
try{
document.getElementById(a).innerHTML=v;
return true;
}
catch(e){
alert('Elementul '+a+' nu poate fi gasit reporniti browserul si incercati din nou');
return false;
}
}
function $id(a){
var rez;
try{
rez=document.getElementById(a);
return rez;
}
catch(e){
alert('Elementul '+a+' nu poate fi gasit reporniti browserul si incercati din nou');
return false;
}
}
function creazaXmlHttp(){
var xmlHttp;
if(window.ActiveXObject){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
xmlHttp = false;
}
}
else{
try{
xmlHttp = new XMLHttpRequest();
}
catch (e){
xmlHttp = false;
}
}
if (!xmlHttp) alert("Nu s-a putut crea obiectul XMLHttpRequest .");
else return xmlHttp;
}
var xmainpath='images/';
var xmlHttp=creazaXmlHttp();
function EjaxCb(phpfile,params,divelem,callback){
if(divelem!=''){
var xdiv=$id(divelem);
var dispwait=true;
}
else {
var xdiv='';
var dispwait=false;
}
//var dispwait=false; // sa nu mai faca loading
this.phppath=phpfile;
var xphp=this.phppath;
if(params!=''){
var xparam='?'+params+"&sid="+Math.random();
}
else{
var xparam="?sid="+Math.random();
}
var xmlHttp=creazaXmlHttp();
this.cerere=function(){
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
xmlHttp.open("GET", xphp+xparam, true);
xmlHttp.onreadystatechange = xrez;
xmlHttp.send(null);
if(dispwait){
//xdiv.innerHTML= ''+'PLEASE WAIT!!!';
document.getElementById('AjaxLoading').style.display='block';
}
}
else{
if(dispwait){
//xdiv.innerHTML= ''+'PLEASE WAIT!!!';
document.getElementById('AjaxLoading').style.display='block';
}
}
};
var xcer=this.cerere;
this.rezultat=function(){
if (xmlHttp.readyState == 4){
if (xmlHttp.status == 200){
var raspuns = xmlHttp.responseText;
if (callback) {callback(raspuns);}
else if(xdiv==''){
alert(raspuns);
}
else{
document.getElementById('AjaxLoading').style.display='none';
xdiv.innerHTML = raspuns;
}
}
else{
alert("Problema la accesare: " +xmlHttp.statusText);
}
}
else{
if(dispwait){
//xdiv.innerHTML= ''+'PLEASE WAIT!!!';
document.getElementById('AjaxLoading').style.display='block';
}
}
};
var xrez=this.rezultat;
xcer();
}
var stock_product=0;
function buy(idp,quantInput) {
if (stock_product<=0) {
error('Acest produs nu este pe stoc');
} else {
var is_valid=true;
var variation='';
number_of_option=array_of_variations.length;
if (number_of_option>0) {
for(var i=0;i selecta o variatie de produs',320,100);
} else {
if (quantInput<1) {
error('Cantitatea trebuie sa fie mai mare de 1!',260,50);
} else {
var add_get='';
if (number_of_option>0) add_get='&variation='+variation;
window.location=window.siteurl+'cart.html?id='+idp+add_get+'&oper=add&quant='+eurl(quantInput);
}
}
}
}
// VARIATIONS BEGIN
var array_of_variations=new Array;
function mod_prod_variation(nr_option,value,id){
var values_ok=tree_of_values[value];
for(var i=(nr_option+1);iSelectati');
$("#select_var_"+i).attr('disabled',true);
}
for (var x in values_ok) {
var new_option=document.createElement('option');
new_option.text=values_ok[x];
new_option.value=x;
try{
document.getElementById('select_var_'+(nr_option+1)).add(new_option,null);
}
catch(ex){
document.getElementById('select_var_'+(nr_option+1)).add(new_option);
}
}
if (value!=0) $("#select_var_"+(nr_option+1)).attr('disabled',false);
array_of_variations[nr_option]=value;
var is_valid=true;
for(var i=0;i