function switchpopup() {
  if($('#searchpopup').css('display')!='none'){
    $('#searchpopup').animate({opacity: 'hide' }, 'slow');
  }else{
    $('#searchpopup').animate({opacity: 'show' }, 'slow');
  }
}

var cache=Array();

function preLoadImages(images) {
  var imgs_len = images.length;
  for (var i = 0; i<imgs_len; i++) {
    var cacheImage = new Image();
    cacheImage.src = images[i];
    cache[i]=cacheImage;
    }
}

if ($.browser.opera){
   $(document).ready(function(){
      $(window).resize(function(){
         $('#wrapper').append('<div id="resize_bug_fixer" style="display:none;"');
         $('#resize_bug_fixer').remove();
      })
   });
}
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);
}

var timerleft1, timerright1, timercenter1, timerleft2, timerright2, timercenter2;

$(document).ready(function() {
  imgs=["/img/footer/im_left.jpg",
                 "/img/footer/im_center.jpg",
                 "/img/footer/im_right.jpg",
                 "/img/footer/bg_left.gif",
                 "/img/footer/bg_center.gif",
                 "/img/footer/bg_right.gif",
                 "/img/searchpopup.png",
                 "/img/sclose.gif"];
  preLoadImages(imgs)
  cookie=getCookie('nopopup');
  if(cookie!='nopopup'){
    timerleft1=window.setTimeout("gsomleft()",5000);
    timerright1=window.setTimeout("gsomcenter()",5250);
    timercenter1=window.setTimeout("gsomright()",5500);
    timerleft2=window.setTimeout("gsomleft()",10000);
    timerright2=window.setTimeout("gsomcenter()",10250);
    timercenter2=window.setTimeout("gsomright()",10500);
    
    var date = new Date();
    date.setTime(date.getTime()+(30*24*60*60*1000));
    cookie="nopopup=nopopup; path=/; expires="+date.toGMTString()+';';
    document.cookie=cookie;
  }
})




function cleartimeouts(){
  
    clearTimeout(timerleft1);
    clearTimeout(timerright1);
    clearTimeout(timercenter1);
    clearTimeout(timerleft2);
    clearTimeout(timerright2);
    clearTimeout(timercenter2);
}

function gsomleft(kill){
  if(kill){
    cleartimeouts();
  }

  if($('#fleft').css('height')=='118px'){
    $('#fleft_c').animate({opacity:'hide'}, 1000, function(){
      $('#darker_left').animate({opacity:'hide'}, 1200);
      $('#fleft').animate({height: '0'}, 1200);
    });
  }
  else{
    $('#darker_left').animate({opacity:'show'}, 1200);
    $('#fleft_c').css('display','block');
    $('#fleft').animate({height: '118px'}, 1200);
  }
}
function gsomright(kill){
  if(kill){
    cleartimeouts();
  }
  if($('#fright').css('height')=='118px'){
    $('#fright_c').animate({opacity:'hide'}, 1000, function(){
      $('#darker_right').animate({opacity:'hide'}, 1200);
      $('#fright').animate({height: '0'}, 1200);
    });
  }
  else{
    $('#darker_right').animate({opacity:'show'}, 1200);
    $('#fright_c').css('display','block');
    $('#fright').animate({height: '118px'}, 1200);
  }
}
function gsomcenter(kill){
  if(kill){
    cleartimeouts();
  }
  if($('#fcenter').css('height')=='118px'){
    $('#fcenter_c').animate({opacity:'hide'}, 1000, function(){
      $('#fcenter').animate({height: '0'}, 1200);
    });
  }
  else{
    $('#fcenter_c').css('display','block');
    $('#fcenter').animate({height: '118px'}, 1200);
  }
}



var empty;
var params = {"wmode":"transparent"};

swfobject.embedSWF("/swf/menu_light.swf", "flashmenu", "200", "300", "9.0.0","/img/expressinstall.swf", empty, params, params);
swfobject.embedSWF("/swf/exp.swf", "expflash", "240", "320", "9.0.0","/img/expressinstall.swf", empty, params, params);
