function pics( img , url ) {
		document.images[img].src = url;
}

function activeButton(id){
	var button  = document.getElementById(id);
	button.className = 'a_button';
}

function passiveButton(id){
	var button  = document.getElementById(id);
	button.className = 'i_button';
}

function openwin(img , w , h , title )
{
	var hWnd;
	if(hWnd!=null)
	hWnd.close();
	hWnd=window.open(img,"","toolbar=no,location=no,directories=no,resizable=no,width=" + w + ",height=" + h );
	hWnd.document.open();
	hWnd.document.write("<html>");
	hWnd.document.write("<head>");
	hWnd.document.write("<title>" + title + "</title>");
	hWnd.document.write("</head>");
	hWnd.document.write("<body bgcolor=#ffffff bottommargin=0 leftmargin=0 marginheight=0 marginwidth=0 rightmargin=0 topmargin=0 style='border:0px;'>");
	hWnd.document.write("<table align=center width=100% height=100% cellspacing=0 cellpadding=0 border=0>");
	hWnd.document.write("<tr><td><img src='"+img+"' border=0></td></tr>");
	hWnd.document.write("</table></body></html>");
	hWnd.document.close();
}

function openwin1(img , w , h , title )
{
	var hWnd;
	if(hWnd!=null)
	hWnd.close();
	hWnd=window.open(img,"","toolbar=no,location=no,directories=no,resizable=no,width=" + w + ",height=" + h );
	hWnd.document.open();
	hWnd.document.write("<html>");
	hWnd.document.write("<head>");
	hWnd.document.write("<title>" + title + "</title>");
	hWnd.document.write("</head>");
	hWnd.document.write("<body bgcolor=#EFEFEE bottommargin=0 leftmargin=0 marginheight=0 marginwidth=0 rightmargin=0 topmargin=0 style='border:0px;'>");
	hWnd.document.write("<table align=center width=100% height=100% cellspacing=0 cellpadding=0 border=0>");
	hWnd.document.write("<tr><td align=center><img src='"+img+"' border=0></td></tr>");
	hWnd.document.write("</table></body></html>");
	hWnd.document.close();
}

function show(id){
	layer = document.getElementById(id);
	if(layer.style.display == "none")
		layer.style.display = "block";
	else 
		layer.style.display = "none";
}

function addBookmark(url, title){
  
  if (!url) url = location.href;
  if (!title) title = document.title;
  

  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel 
(title, url, "");
 
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
 
   else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
  
  return true;
}

function IEPngFix( img , width , height , unique_name ) {

	var code = '<IMG SRC="'+ img +'" WIDTH="' + width + '" HEIGHT="' + height + '" BORDER=0 name='+ unique_name +'>';
	if( navigator.userAgent.indexOf("Opera") > 1 )
		document.write(code);
	else
		if( navigator.userAgent.indexOf("MSIE 6") > 1 )
			document.write('<IMG SRC="/img/emp.gif" WIDTH="' + width + '" HEIGHT="' + height + '" BORDER="0" ALT="" STYLE="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src=' + img + ' , sizingMethod=scale );">');
		else
			if(navigator.userAgent.indexOf("MSIE 5") != -1)
				document.write(code);
			else
				document.write(code);
				
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

$(document).ready(init);

function init() {	
	if ('1' != readCookie('isaw'))
    {
    	$("#club_keyauto").show();
    	createCookie('isaw', 1, 365);
    }
	
    $.extend(DateInput.DEFAULT_OPTS, {
      stringToDate: function(string) {
        var matches;
        if (matches = string.match(/^(\d{2,2})\.(\d{2,2})\.(\d{4,4})$/)) {
          return new Date(matches[3], matches[2] - 1, matches[1]);
        } else {
          return null;
        };
      },

      dateToString: function(date) {
        var month = (date.getMonth() + 1).toString();
        var dom = date.getDate().toString();
        if (month.length == 1) month = "0" + month;
        if (dom.length == 1) dom = "0" + dom;
        return  dom + "." + month + "." + date.getFullYear();
      }
    });
    
    $.extend(DateInput.DEFAULT_OPTS, {
        month_names: ["ßíâàðü", "Ôåâðàëü", "Ìàðò", "Àïðåëü", "Ìàé", "Èþíü", "Èþëü", "Àâãóñò", "Ñåíòÿáðü", "Îêòÿáðü", "Íîÿáðü", "Äåêàáðü"],
        short_month_names: ["ßíâ", "Ôåâ", "Ìàð", "Àïð", "Ìàé", "Èþí", "Èþë", "Àâã", "Ñåí", "Îêò", "Íîÿ", "Äåê"],
        short_day_names: ["Âñ", "Ïí", "Âò", "Ñð", "×ò", "Ïò", "Ñá"]
    });
    
    $($.date_input.initialize);
}

function close_banner() {
	$("#club_keyauto").hide();
}