function movepic(img_name,img_src) {
    document[img_name].src=img_src;
}
function renewCode(base){
    var myRandom = parseInt(Math.random()*99999999);
    $('#c_security_img').attr( 'src', base+'/random.php?what=contact&renew=true&rand=' + myRandom );
}

function checkstring(formid){
    var flag=0;
    var reqname=/^[a-zA-Z-` ]+$/;
    var reqnum=/^[0-9- ]+$/;
    var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
    var neededvalues=["name","mail","phone","code"];
    var form=document.getElementById(formid);
    for (var n=0; n < form.elements.length; n++){
        if(form.elements[n].value.trim()==""){
            for(i in neededvalues){
                if(form.elements[n].name==neededvalues[i]){
                    flag=1;
                    form.elements[n].style.border="1px solid red";
                }
            }
        }
    }
    if(flag==1){
        alert("Fill empty fields");
        return false
    }
    else
        return true;
}
 
function setData(name,mail,phone,service,comment) {
    document.getElementById('name').value=name;
    document.getElementById('mail').value=mail;
    document.getElementById('phonee').value=phone;
    document.getElementById('service').value=service;
    document.getElementById('comment').value=comment;
}
function selectTextbox(id){
    id.style.backgroundPosition='0px bottom';
    id.style.height='27px';
}
function normalTextbox(id){
    id.style.backgroundPosition='0px 0px';
    id.style.height='27px';
}
function selectTextarea(id){
    id.style.backgroundPosition='0px bottom';
    id.style.height='89px';
}
function normalTextarea(id){
    id.style.backgroundPosition='0px 0px';
    id.style.height='87px';
}
function overBook(id){
    id.style.backgroundPosition='0px -52px';
}
function normalBook(id){
    id.style.backgroundPosition='0px 0px';
//id.style.height='85px';
}
function reloadCode(base) {
    $('#codeimg').attr('src',base+"/code.php?p="+Math.random()*100 );
}
function setText(a, b)
{
    x = document.getElementById(a);
    if (x)
        x.innerHTML = b.options[b.selectedIndex].innerHTML;
}
function hide_popup(){
    $("#popup").css({
        'display':'none'
    });
    $(".opac").css({
        'display':'none'
    });
}
function show_popup(){
    $("#popup").css({
        'display':'block'
    });
    $(".opac").css({
        'display':'block'
    });
}
var doAnimate = true;
function contentRotator(content,img,base) {

    if (doAnimate) {

        content.fadeOut("fast", function(content) {

            return function() {

				

                /* HIDE ALL ITEMS */

				

                $("ul#banner > li").hide();

				setTimeout(function() {

						img.prev().attr("src",base+"/assets/images/navoff.png");

						img.attr("src",base+"/assets/images/navon.png");

                        }, 1000);

                content.fadeIn(2500, function() {

                    

                    /* GO BACK TO FIRST ITEM */



                    if ($(this).attr("id") == $("ul#banner > li:last").attr("id")) {



                        setTimeout(function() {

							$("#circles img:last").attr("src",base+"/assets/images/navoff.png");

                            contentRotator($("ul#banner > li:first"),$("#circles img:first"),base);



                        }, 5000);

						setTimeout(function() {

						img.attr("src",base+"/assets/images/navoff.png");

                        }, 5000);

                    }



                    else { /* FADE IN NEXT ITEM  */



                        setTimeout(function() {

						

                        contentRotator($(content.next()),$(img.next()),base);

                        }, 5000);



                    }



                });



            };



        } (content));



    }

}

function contentRotator2(content,img,base) {

    if (doAnimate) {

        content.fadeOut("fast", function(content) {

            return function() {

				

                /* HIDE ALL ITEMS */

				

                $("ul#news_items > li").hide();

				setTimeout(function() {

						img.prev().attr("src",base+"/assets/images/navoff.png");

						img.attr("src",base+"/assets/images/navon.png");

                        }, 1000);

                content.fadeIn(2500, function() {

                    

                    /* GO BACK TO FIRST ITEM */



                    if ($(this).attr("id") == $("ul#news_items > li:last").attr("id")) {



                        setTimeout(function() {

							$("#circ img:last").attr("src",base+"/assets/images/navoff.png");

                            contentRotator($("ul#news_items > li:first"),$("#circ img:first"),base);



                        }, 5000);

						setTimeout(function() {

						img.attr("src",base+"/assets/images/navoff.png");

                        }, 5000);

                    }



                    else { /* FADE IN NEXT ITEM  */



                        setTimeout(function() {

						

                        contentRotator2($(content.next()),$(img.next()),base);

                        }, 5000);



                    }



                });



            };



        } (content));



    }

}

$(document).ready(function (){
    $("#selectbox").change(function (){
        $("#areas_txt").text($(this).val());
	
    });
});
