
function submitNewsletter()
{
var email = document.forms['letter'].elements['email'].value;
var melden = document.forms['letter'].elements['melden'];
var val = '';

var len = melden.length;
if(len == undefined) return;

for(var i=0;i<=len;i++) {
    if(i==len) return;

    if(melden[i].checked)
    {
        val=melden[i].id;
        break;
    }
}

var req = mint.Request();
req.method="POST";
req.AddParam('email',email);
req.AddParam('melden',val);

req.OnSuccess = function()
{
    if(req.responseText!='') alert(req.responseText);
}

req.Send(liveSite+'/includes/ajax/newsletter.php');
}

function sleep(seconds) {
    // http://kevin.vanzonneveld.net
    // +   original by: Christian Doebler
    // +   bugfixed by: Brett Zamir (http://brettz9.blogspot.com)
    // %          note: For study purposes. Current implementation could lock up the user's browser.
    // %          note: Consider using setTimeout() instead.
    // *     example 1: sleep(1);
    // *     returns 1: 0

    var start = new Date().getTime();
    while (new Date() < start + seconds*1000);
    return 0;
}

function resizeIframeHeight(nHeight) {
    $('#frm').height(parseInt(nHeight));
}

//loading page to frame

function changeUrl(url,hidetop) {
    $("#frm").remove();
    var cnt = $('#content_left');
    var ltcnt = $('#content_left_top');
    var clc = $('#content_left_cnt');


    var ifr=jQuery('<iframe frameborder="0"/>');
    ifr.attr('id','frm');
    ifr.attr('scrolling','no');
    ifr.attr('frameborder','0');
    ifr.attr('marginheight','0');
    ifr.attr('marginwidth','0');
    ifr.width(573);
    ifr.height(1000);
    ifr.css('border','none');
    ifr.attr('src',url);

    $("#content_left_top").after(ifr);

    if(clc.css('display')!='none') clc.hide();
    
    if(hidetop) ltcnt.hide();


}

//load page and not hide top

function loadContent(url) {
    changeUrl(url,false);
}

//load page and hide top

function redirectFrame(url) {
    changeUrl(url,true);
}

//load object data

function loadObjInfo(url,id) {
    objdet=id;

    $("#back_to_list").attr("style","display:block");
    $("#content_left_top").hide();
    changeUrl(url,true);
}

//send search form and get response

function InitAjaxPost(sField,url,destObj)
{
    $("#loading_data").show();
    $("#result_list_with_footer_paging").hide();
    var oForm = $("#"+sField);
    var sUrl=url;
           $.post(sUrl, oForm.serialize(), function(sResponse) {
        $("#loading_data").remove();
        $("#"+destObj).html(sResponse);
        });
}

//get regions select

function getRegions(cnt,def,destobj)
{
    if(destobj==null) destobj='regions_select';
    $.get(liveSite+'/includes/ajax/regions.php',{ country: ""+cnt, def: ""+def } ,function(data) { $("#"+destobj).attr('innerHTML',data); });
}

//get list of objects

function loadSearchList(country,region) {
    $("#country").attr('value',country);
    $("#region").attr('value',region);
    $("#page").attr("value",1);
    $.get(liveSite+'/includes/ajax/regions.php',{ country: ""+country, def: ""+region } ,function(data) { $("#regions_select").attr('innerHTML',data); $("#search_form").submit(); });
}

//back to list

function backToList() {
    objdet=null;
    $("#back_to_list").hide();
    $("#frm").remove();
    $("#content_left_top").show();
    $("#content_left_cnt").show();
}

function changeLang(url) {

    if(objdet!=null && objdet!='')
    {
        window.location=url+","+objdet;
    }
    else window.location=url;
}

function changePage(pg)
{
    $("#page").attr("value",pg);
    InitAjaxPost("search_form",liveSite+"/templates/content_search.template.php","content_left_cnt");
}

function advChangePage(pg)
{
    $("#adv_page").attr("value",pg);
    InitAjaxPost("adv_search_form",liveSite+"/templates/content_adv_search.template.php","adv_results");
    window.scrollTo(0, 0);
}

function showShadowbox(url,w,h)
{
  var tmp=new Object();
  tmp.player='iframe';
  tmp.content=url;
  tmp.width=800;
  tmp.height=620;
  
  if(w && w!='default' && w!='' && w!='0') tmp.width=w;
  if(h && h!='default' && h!='' && h!='0') tmp.height=h;
  Shadowbox.open(tmp);

}

function printPage(vl)
{
    var tmphref=vl+"&print=1";
    window.open(tmphref, 'print','height=1,width=1');
    
}

$("document").ready(function() { $(".maruda").click(function() { redirectFrame(this); return false} ); });

