$(document).ready(function() {
/*
  $.get('realcounter.php', {data: ""}, function(res){
    var obj = $.evalJSON(res);
      $("#totalv").html(obj.totalv);
      $("#weeklyv").html(obj.weeklyv);
      $("#dailyv").html(obj.dailyv);
      $("#online").html(obj.online);
  });
   var refreshId = setInterval(function() {
        $.get('realcounter.php', {data: ""}, function(res){
    var obj = $.evalJSON(res);
      $("#totalv").html(obj.totalv);
      $("#weeklyv").html(obj.weeklyv);
      $("#dailyv").html(obj.dailyv);
      $("#online").html(obj.online);
  })
   }, 500000);
  */
if( $.cookie("alert") == "yes"){
 $("#alert").hide("fast");
}else{
 $("#alert").show("slow");
}
$("#close").click(function() {
 $("#alert").hide("slow");
 $.cookie("alert", "yes", { expires: 1 });
 return false;
});
$('div#cycleq').cycle({ 
    fx:     'fade', 
    timeout: 7000, 
    delay:  -1000
});

$('div#cycle').cycle({ 
    fx:     'fade', 
    timeout: 6000, 
    delay:  -2000
});
$('div#cycleb').cycle({ 
  fx: 'blindY,blindX,blindZ,scrollUp,slideX,slideY', 
  timeout: 6000, 
  delay:  -2000
});
   var refreshId2 = setInterval(function() {
$('div#cycleb').cycle({ 
  fx: 'blindY,blindX,blindZ,scrollUp,slideX,slideY', 
  timeout: 6000, 
  delay:  -2000
});
   }, 50000);
tooltip();
$("#qsearch input[type=text]").click(function() {
 $("#qsearch input[type=text]").css("border", "1px orange solid").attr("readonly", true).val('');
 $(this).css("border", "1px red solid").removeAttr("readonly");
});

//simple modal
	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
        var offset = $("#header").offset().top - 10;
        $("html, body").animate({scrollTop:offset}, "slow");
        
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1);	
		$('#mask').fadeTo("",0.5);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(1); 
	
	});
	
	//if close button is clicked
	$('.window .closem').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
        var offset = $("#justposition").offset().top - 100;
        $("html, body").animate({scrollTop:offset}, "slow");
	});		
	//if close button is clicked
	$('.window .closem1').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		$('#mask').hide();
		$('.window').hide();

	});	
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
        var offset = $("#justposition").offset().top - 100;
        $("html, body").animate({scrollTop:offset}, "slow");
	});			
//end of modal

});
function updatepoll(val){
var val;
$("#votewaiting").html('<center><img src="images/index/ajax.gif" alt="ʘ? ???..." /></center>');
 $.ajax({  
  type: "GET", 
  url: "frontpage/vote.php",
  data: val,  
  success: function(msg){
   $("#vote").html(msg);
  }
 });
}

$(document).ready(function() {
$(".fadein div").css({position:"absolute", left:"0", top:"0"});
$(".adver div").css({position:"absolute", right:"0", left:"0", top:"0"});
$(".fadein").css({position:"relative"});
$(".adver").css({position:"relative"});
(function($){
  $.fn.simplestSlideShow = function(settings){
    var config = {
      'timeOut': 3000,
      'speed': 'normal'
    };
    if (settings) $.extend(config, settings);
    this.each(function(){
      var $elem = $(this);
      $elem.children(':gt(0)').hide();
      setInterval(function(){
        $elem.children().eq(0).fadeOut(config['speed'])
        .next().slideDown(config['speed'])
        .end().appendTo($elem);
      }, config['timeOut']);
    });
    return this;
  };
})(jQuery);
$(".fadein").simplestSlideShow({'timeOut': 5000, 'speed': 1000});
$(".adver").simplestSlideShow({'timeOut': 5000, 'speed': 1000});
});
