var exp = new Date(); 
exp.setTime(exp.getTime() + (10*24*60*60*1000));

function set_visible(el, flag) {

    el.style.visibility = flag ? 'visible' : 'hidden';

}


function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
   }
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) 
{  
var arg = name + "=";  
    var alen = arg.length;  
    var clen = document.cookie.length;  
    var i = 0;  
    while (i < clen) 
    {    
        var j = i + alen;    
        if (document.cookie.substring(i, j) == arg)      
        return getCookieVal (j);    
        i = document.cookie.indexOf(" ", i) + 1;    
        if (i == 0) break;   
    }  
return null;
}

function SetCookie (name, value) 
{  
    var argv = SetCookie.arguments;  
    var argc = SetCookie.arguments.length;  
    var expires = (argc > 2) ? argv[2] : null;  
    var path = (argc > 3) ? argv[3] : null;  
    var domain = (argc > 4) ? argv[4] : null;  
    var secure = (argc > 5) ? argv[5] : false;  
    document.cookie = name + "=" + escape (value) + 
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
    ((path == null) ? "" : ("; path=" + path)) +  
    ((domain == null) ? "" : ("; domain=" + domain)) +    
    ((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) 
{  
    var exp = new Date();  
    exp.setTime (exp.getTime() - 1);  
    var cval = GetCookie (name);  
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function btn_close()
{
    set_visible(document.getElementById('photo'),false);
    document.getElementById('photocard').style.height = '30px';
    document.getElementById('btn_close').innerHTML = '<a href="javascript:btn_open();"><img src="images/ico-open.gif" alt="" width="9" height="9" /></a>';
    SetCookie('bmt_image','close');
}

function btn_open() 
{
    set_visible(document.getElementById('photo'),true);
    document.getElementById('btn_close').innerHTML = '<a href="javascript:btn_close();"><img src="images/ico-close.gif" alt="" width="9" height="9" /></a>';
    document.getElementById('photocard').style.height = '320px';
    SetCookie('bmt_image','open');
}




// поисковая менюшка 
function set_search(num)
{
 document.getElementById('s1').style.cssText = "color: #d9ffe3; margin-left: 16px; text-decoration: none;  border-bottom: dashed 1px;";
 document.getElementById('s2').style.cssText = "color: #d9ffe3; margin-left: 16px; text-decoration: none;  border-bottom: dashed 1px;";
 document.getElementById('s3').style.cssText = "color: #d9ffe3; margin-left: 16px; text-decoration: none;  border-bottom: dashed 1px;";
 document.getElementById('s_type').value = num;
 
 
 document.getElementById('s'+num).style.cssText = "color: #d9ffe3; margin-left: 16px; text-decoration: none;  border-bottom: none;";
 return 1;
}


function town(id, max)
{
    for(var i=0;i<=max;i++)
    {
        document.getElementById('t_'+i).style.display = 'none';
    }
    document.getElementById(id).style.display = 'block';
    SetCookie('town_vis',id);
    return 1;
}





function OpenRadio(){
Radio = window.open('http://www.ladoshki.ch/forum/vBRadio.php','vBRadio','directories=no,height=320,width=650,location=no,menubar=no,resizable=no,status=no,toolbar=no')
return false;
}
