function changeRegType(){    $.get("ajax/ajax.php?action=changeRegType",function(data){        if(data) document.location.href = "index.php?option=com_registration&task=edit"; else alert('err');         })     }function window_open(url, width, height, name, scroll_bar, location){	_top = Math.ceil((screen.height - height)/2);	_left = Math.ceil((screen.width - width)/2);	if(scroll_bar != true){		var scroll = 'no';	}else{		var scroll = 'yes';	}	if(typeof location != "undefined" && location == true){		var location = 'yes';	}else{		var location = 'no';	}	if(name == undefined){		name = Math.round(999999 * Math.random());	}	new_win = window.open(url, name , 'width=' + width + ',height=' + height + ',location='+ location +',status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=' + scroll + ',top=' + _top + ',left=' + _left);	new_win.focus();	return new_win;}function delete_logo(id){    $.get("ajax/ajax.php?action=delete_logo&img="+encodeURIComponent(id),function(){        document.location.href = "index.php?option=com_contact&task=chlogo";        })    }function delete_photo(id){    $.get("ajax/ajax.php?action=delete_photo&img="+encodeURIComponent(id),function(){        document.location.href = "index.php?option=com_contact&task=chphoto";        })    }function delete_cargo(id){    $(document).ready(function(){        var obj = document.form_d.cargo_id        if(obj.length){            for(i=0;i<obj.length;i++){                if (obj[i].checked == true){                    $.get("ajax/ajax.php?action=delete_cargo&id="+encodeURIComponent(obj[i].value),function(){                        your_cargo_offer(id)                    });                }            }        }else{            if(obj.checked == true){                $.get("ajax/ajax.php?action=delete_cargo&id="+encodeURIComponent(obj.value),function(){                    your_cargo_offer(id)                });                }        }    })    }function delete_truck(id){    $(document).ready(function(){        var obj = document.form_d.truck_id        if(obj.length){            for(i=0;i<obj.length;i++){                if (obj[i].checked == true){                    $.get("ajax/ajax.php?action=delete_truck&id="+encodeURIComponent(obj[i].value),function(){                        your_truck_offer(id)                    });                }            }        }else{            if(obj.checked == true){                $.get("ajax/ajax.php?action=delete_truck&id="+encodeURIComponent(obj.value),function(){                    your_truck_offer(id)                });                }        }    })   }function cargo_tab_from(fromLand){    $(document).ready(function(){        $.get("ajax/ajax.php?action=cargo&task=from&from="+encodeURIComponent(fromLand),function(data){            $("tr.ajax_child").remove();            $("#cargo_tab").append(data);        });    })}function cargo_tab_to(toLand){    $(document).ready(function(){        $.get("ajax/ajax.php?action=cargo&task=to&to="+encodeURIComponent(toLand),function(data){            $("tr.ajax_child").remove();            $("#cargo_tab").append(data);        });    })}function view_to_lands(fromLand,toLand){    $(document).ready(function(){        if(toLand == 0){            $.get("ajax/ajax.php?action=cargo&task=from&from="+encodeURIComponent(fromLand),function(data){                $("tr.ajax_child").remove();                $("#cargo_tab").append(data);            });            }else{            $.get("ajax/ajax.php?action=cargo&task=to&to="+encodeURIComponent(toLand)+"&from="+encodeURIComponent(fromLand),function(data){                $("tr.ajax_child").remove();                $("#cargo_tab").append(data);            });        }    });}function view_from_lands(toLand,fromLand){    $(document).ready(function(){        if(fromLand == 0){            $.get("ajax/ajax.php?action=cargo&task=to&to="+encodeURIComponent(toLand),function(data){                $("tr.ajax_child").remove();                $("#cargo_tab").append(data);            });            }else{            $.get("ajax/ajax.php?action=cargo&task=from&from="+encodeURIComponent(fromLand)+"&to="+encodeURIComponent(toLand),function(data){                $("tr.ajax_child").remove();                $("#cargo_tab").append(data);            });        }    });    }function truck_tab_to(toLand){    $(document).ready(function(){        $.get("ajax/ajax.php?action=truck&task=to&to="+encodeURIComponent(toLand),function(data){            $("tr.ajax_child").remove();            $("#cargo_tab").append(data);        });    })    }function truck_tab_from(fromLand){    $(document).ready(function(){        $.get("ajax/ajax.php?action=truck&task=from&from="+encodeURIComponent(fromLand),function(data){            $("tr.ajax_child").remove();            $("#cargo_tab").append(data);        });    }) }function view_from_lands_truck(toLand,fromLand){    $(document).ready(function(){        if(fromLand == 0){            $.get("ajax/ajax.php?action=truck&task=to&to="+encodeURIComponent(toLand),function(data){                $("tr.ajax_child").remove();                $("#cargo_tab").append(data);            });            }else{            $.get("ajax/ajax.php?action=truck&task=from&from="+encodeURIComponent(fromLand)+"&to="+encodeURIComponent(toLand),function(data){                $("tr.ajax_child").remove();                $("#cargo_tab").append(data);            });        }    });   }function view_to_lands_truck(fromLand,toLand){    $(document).ready(function(){        if(toLand == 0){            $.get("ajax/ajax.php?action=truck&task=from&from="+encodeURIComponent(fromLand),function(data){                $("tr.ajax_child").remove();                $("#cargo_tab").append(data);            });            }else{            $.get("ajax/ajax.php?action=truck&task=to&to="+encodeURIComponent(toLand)+"&from="+encodeURIComponent(fromLand),function(data){                $("tr.ajax_child").remove();                $("#cargo_tab").append(data);            });        }    });}function your_cargo_offer(id){    var fromLand = $("#fromLand").val();    var toLand = $("#toLand").val();    $.get("ajax/ajax.php?action=your_cargo&to="+encodeURIComponent(toLand)+"&from="+encodeURIComponent(fromLand)+"&id="+encodeURIComponent(id),function(data){        $("tr.ajax_child").remove();        $("#cargo_tab").append(data);    });}function your_truck_offer(id){    var fromLand = $("#fromLand").val();    var toLand = $("#toLand").val();    $.get("ajax/ajax.php?action=your_truck&to="+encodeURIComponent(toLand)+"&from="+encodeURIComponent(fromLand)+"&id="+encodeURIComponent(id),function(data){        $("tr.ajax_child").remove();        $("#cargo_tab").append(data);    });}function SpanFromRegion(obj){    $(document).ready(function(){        $.get("ajax/ajax.php?action=region&id="+encodeURIComponent(obj.value)+"&reg="+encodeURIComponent('FromLand'),function(data){            $("span#spanfromregion").html(data);        })        });  }function SpanFromRegionEdit(obj,selected){    $(document).ready(function(){        $.get("ajax/ajax.php?action=region&id="+encodeURIComponent(obj)+"&reg="+encodeURIComponent('FromLand')+"&selected="+encodeURIComponent(selected),function(data){            $("span#spanfromregion").html(data);           });        });}function SpanToRegion(obj){    $(document).ready(function(){        $.get("ajax/ajax.php?action=region&id="+encodeURIComponent(obj.value)+"&reg="+encodeURIComponent('ToLand'),function(data){            $("span#spantoregion").html(data);        })        });     }function SpanToRegionEdit(obj,selected){    $(document).ready(function(){        $.get("ajax/ajax.php?action=region&id="+encodeURIComponent(obj)+"&reg="+encodeURIComponent('ToLand')+"&selected="+encodeURIComponent(selected),function(data){            $("span#spantoregion").html(data);           });        });}function checkAjax(type,This){    if(This.id){        $.get("ajax/check.php?type="+type+"&val="+$(This).val()+"&id="+This.id,function(data){            $("span#error_"+This.id).html('');            $("span#error_"+This.id).fadeIn(1000).html(data);        })    }    }function checkAjaxAlert(type,This){    if(This.id){        $.get("ajax/check.php?type="+type+"&val="+$(This).val()+"&id="+This.id,function(data){            if(data) alert(data);        })    }    }function setCookie (name, value, expires, path, domain, secure) {      document.cookie = name + "=" + escape(value) +        ((expires) ? "; expires=" + expires.toGMTString() : "") +        ((path) ? "; path=" + path : "") +        ((domain) ? "; domain=" + domain : "") +        ((secure) ? "; secure" : "");}function getCookie(name) {var cookie = " " + document.cookie;var search = " " + name + "=";var setStr = null;var offset = 0;var end = 0;if (cookie.length > 0) {offset = cookie.indexOf(search);if (offset != -1) {offset += search.length;end = cookie.indexOf(";", offset)if (end == -1) {end = cookie.length;}setStr = unescape(cookie.substring(offset, end));}}return(setStr);} var cookies = getCookie('popuptraf');var expires = new Date();var pribavok=(24-expires.getHours())*3600 * 1000;expires.setTime(expires.getTime() + pribavok);if (cookies != "yes") { Logist(); setCookie("popuptraf","yes",expires); } function Logist(){$.post("/logist.php", function(data) {$("body").prepend(data);});}function Close(){$(".fade").remove();$(".logist").remove();}
