function pushx(x)
{
	setCookie("search",x);
}
function getx()
{
	var x = getCookie("search");
	setCookie("search");
	if ((x<=0)||(x>=32000)||(x==null)||(x=="undefined")) return false;
	document.location.href = "/search.htm?x="+x;
	return false;
}

function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}


function ShortWindow(x,ww,wh){
  var sc="yes";
  if(x.substr(1,5)=="photo") sc="no";
  var l=(screen.width-ww)/2;
  var h=(screen.height-wh)/2;
  var a=window.open(x,"smallwindow","left="+l+",width="+ww+", height="+wh+",top="+h+", status=no, toolbar=no, menubar=no, resizable=yes, scrollbars="+sc);
  a.focus();
  return false;
}

    function functHideParent(index){
        if (document.getElementById("parent" + index).className == "parent_active"){
            document.getElementById("parent" + index).className="";
            document.getElementById("childMenu" + index).style.display ="none";
        }
        else {       
            document.getElementById("parent" + index).className="parent_active";
            document.getElementById("childMenu" + index).style.display ="block";
        }         
    }    
    function functHideChild(indexParent, indexChild){
        if (document.getElementById("child" + indexChild).className == "child_active"){
            document.getElementById("child" + indexChild).className="";
            document.getElementById("babyMenu" + indexChild).style.display ="none";
        }
        else {
            document.getElementById("child" + indexChild).className="child_active";
            document.getElementById("babyMenu" + indexChild).style.display ="block";
        }
        functHideParent(indexParent)
    }    



$(document).ready(function(){

    $('.box').prepend('<div class="box-c"><em class="ctl"><b>&bull;</b></em><em class="ctr"><b>&bull;</b></em></div>');
    $('.box').append('<div class="box-c"><em class="cbl"><b>&bull;</b></em><em class="cbr"><b>&bull;</b></em></div>');
    var timer;
	StartTimer();  

	$(".topnews li").hoverIntent(function(){
        if($(this).hasClass("here")){
            
        }else{
			$(".topnews li.here i").remove();
            $(".topnews li").removeClass("here");
            $(this).addClass("here").append("<i></i>");
            bem=$(this).attr("id");
            $(".news-scroll .news-scroll-img:visible").fadeOut(300,function(){
                
            });
            $("#img-"+bem).fadeIn(300)
        }
    },function(){});

	$("#vmenu li a").click(function(){
		if(!$(this).next().is('ul')){
			window.location = $(this).attr('href');
		}else{
			$("#vmenu li").removeClass("selected").find('ul').hide("fold");
			if($(this).next('ul').css("display") == 'none'){
				$(this).parent().addClass('selected');
				$(this).next('ul').show("fold");
			}else{
				$(this).parent().removeClass('selected');
				$(this).next('ul').hide("fold");
			}
			return false;
		}
	});
	
    $(function() {
//		$( "#vmenu" ).accordion({ 
//			collapsible: true,
//			autoHeight: false,
//			navigation: true
//		});
	});
    
});
function StartTimer(){
//	var timer;
	timer = window.setInterval("timerFn();", 5000);
}
function StopTimer(){
//	var timer;
	window.clearInterval(timer);
}
function timerFn(){
		var curr = $('#sport_mans a.current');
        if(curr.next('a').size()!= 0) {
            var nexta = curr.next('a')[0];
        }
        else {
            var nexta = $('#tab1')[0];
        }
        SelectTab(nexta);
}
function SelectTab(el){
    //if (!el || el.className == 'current') return false;
    var id = $(el).attr('id');
    $('#samblock').css('background-image', 'url("/images/samblock-'+id+'.gif")');
    $('#samblock div.show1').removeClass('show1');
    $('.for_'+id).addClass('show1');
    $('#sport_mans a.current')[0].className = "";
    el.className = "current";
}

