var used='';

var timer = null;

$().ready(function(){
    showTime();
});

function IsEmail(str){
    var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)")
    var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$")
    return (!r1.test(str) && r2.test(str))
}

function isEmpty (txt){
    var ch;
    if (txt == "") return true;
    for (var i=0; i<txt.length; i++){
        ch = txt.charAt(i);
        if (ch!=" " && ch!="\n" && ch!="\t" && ch!="\r") return false;
    }
    return true;
}

trig = 1;
function showTime(){ 
    
    thelement = document.getElementById? document.getElementById("tick2"): document.all.tick2;
    var Digital=new Date();
    var hours=Digital.getHours();
    var minutes=Digital.getMinutes();
    var dt = "#000000";
    
    if (trig==1) {
        dt = "#3EC6FF";
        trig = 0;
    } else {
        dt = "#000000";
        trig = 1;
    }

    if (hours<=9) 
        hours="0"+hours;
    if (hours==0) 
        hours="00";
    if (minutes<=9) 
        minutes="0"+minutes;
    
    $("div#hour").html(hours);
    $("div#colon").css("color",dt);
    $("div#minute").html(minutes);
    
    setTimeout("showTime()",500) 
} 


function showCityChange(){
    document.getElementById('regionDiv').innerHTML='';

    new $.ajax({
        url: '/_choosecity.php',
        beforeSend: function(){
          // перед тем как "спросить" - отображаем loading картинку
          document.getElementById('don').style.display='none';
          document.getElementById('don2').style.display='inline';
        },
        success: function(data){
          document.getElementById('regionDiv').innerHTML=data;
          document.getElementById('don').style.display='inline';
          document.getElementById('don2').style.display='none';
        }
        });

    var value=document.getElementById("hidInput").value;
    if(value=="false"){
        document.getElementById("regionChangeForm").style.display='block';
    }else{
        document.getElementById("regionChangeForm").style.display='none';
    }
}

function closeCityChangeForm(){
    document.getElementById("regionChangeForm").style.display='none';
    //setTimeout("refreshIt()",1000);
}

function refreshIt(){
    window.location=unescape(window.location.pathname);
}

function PrintPath(){
  var path   = unescape(document.location.pathname);
  var params = (document.location.search);
  path = "/print" + path + params;
  window.open(path,"print","width=640, height=475, resizable=yes, scrollbars=yes");
} 
