document.createElement("article");
document.createElement("footer");
document.createElement("header");
document.createElement("hgroup");
document.createElement("nav");
document.createElement("aside");
$(document).ready(function(){	
	$("#slider").easySlider({
		auto: true,
		continuous: true,
		numeric: true
	});
});
/* Tooltip */
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = -10;
		yOffset = 15;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

// starting the script on page load
$(document).ready(function(){
	tooltip();
});
(function($) {
	$.fn.defaultify = function(defaultValue) {
		return this.each(function(i) {
			var $this = $(this);
			$this.val(defaultValue);
			$this.focus(function(e) {
				if ($.trim($this.val()) == defaultValue) $this.val("");
			});
			$this.blur(function(e) {
				if ($.trim($this.val()) == "") $this.val(defaultValue);
			});
		});
	};
})(jQuery);

/* Scroller */
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('Q.P.O=3(z){1 p=z||{y:"N",x:"M",w:"L",v:K,u:"a",t:J};1 d=$("#"+p.y);1 c=$("#"+p.x);1 2=$("#"+p.w);1 j=p.v;1 e=p.u;1 4=p.t;1 g;1 9=3(){c.s("5",9);6(4)h();2.r({f:-j},\'q\',\'\',3(){2.i(e+":I").H(2);2.b("f",0);c.n("5",9);6(4)8()})};1 7=3(){d.s("5",7);6(4)h();2.i(e+":o").G().F().E(2);2.b("f",-j);2.r({f:0},\'q\',\'\',3(){2.i(e+":o").D();d.n("5",7);6(4)8()})};d.b("m","l").5(7);c.b("m","l").5(9);1 8=3(){g=k.C(7,B)};1 h=3(){k.A(g)};6(4)8()};',53,53,'|var|_imgFrame|function|_auto|click|if|turnRight|autoPlay|turnLeft||css|_btnPrev|_btnNext|_child|marginLeft|_itv|autoStop|find|_width|window|hand|cursor|bind|last||fast|animate|unbind|auto|child|width|frame|prev|next|params|clearInterval|3000|setInterval|remove|prependTo|show|clone|appendTo|first|true|100|viewerFrame|buttonPrev|buttonNext|imageScroller|fn|jQuery'.split('|'),0,{}))
$(document).ready(function(){
	$(".gallery").imageScroller({
		next:"btn1",
		prev:"btn2",
		frame:"m-gallery",
		width:96,
		child:"li",
		auto:false
	});
 });


//arrays of objects to collect previous and current tab
var previous = [];
var current = [];
//array to store IDs of our tabs
//store setInterval reference
var tablist = [];
 
//change tab and highlight current tab title
function change(block){
 //don't do anything if it's the same tab
 if(current[block].reference == previous[block].reference) return;
 //show proper tab, catch IE6 bug
 if (jQuery.browser.msie && jQuery.browser.version.substr(0,3) == "6.0")
 jQuery(block + ' .tab#' + current[block].reference).show();
 else
 jQuery(block + ' .tab#' + current[block].reference).fadeIn();
 
 //clear highlight from previous tab title
 jQuery(block + ' .htabs a[href=#' + previous[block].reference + ']').removeClass('select');
 
 //highlight currenttab title
 jQuery(block + ' .htabs a[href=#' + current[block].reference + ']').addClass('select');
 
 //hide the other tabs
 jQuery("#" + previous[block].reference).hide();
 //stores a reference to the current tab in advance for the next iteration or click
 previous[block].reference = current[block].reference;
}
function Tab(blockid){
 var z = 0;
 //stores self ID internally
 this.block = blockid;
 //function to rotate internal tabs
 this.next = function (){
 //store references to current and next tab
 previous[this.block].reference = jQuery(this.block + ' .htabs a').get()[z].href.split('#')[1];
 if(z >= jQuery(this.block + ' .htabs a').get().length-1) z = 0; else z++;
 current[this.block].reference  = jQuery(this.block + ' .htabs a').get()[z].href.split('#')[1];
 //advance to next tab
 if(blockid=='#special-content')
 change(this.block);
 };
}
 
function Reference(reference){ this.reference = reference; }
function tabs(tobj){
 
 for (key in tobj) {
 
 var params = tobj[key].split('&');
 var block = params[0];
 
 //initialize tabs, display the current tab
 jQuery(block + " .tab:not(:first)").hide();
 jQuery(block + " .tab:first").show();
 
 //highlight the current tab title
 jQuery(block + ' .htabs a:first').addClass('select');
 
 //stores reference to first tab when function starts, tab 1 from left to right
 previous[block] = new Reference(jQuery(block + " .htabs a:first").attr("href").split('#')[1]);
 
 //stores reference to second tab when the function starts, tab 2 from left to right
 current[block]  = new Reference(jQuery(block + ' .htabs a').get()[1].href.split('#')[1]);
 
 //create new Tab object to store values for rotation and setInterval id
 tablist[block] = new Tab(block);
 
 //skip if no speed is defined
 if (params[1] != undefined) {
  //set interval to repeat - next line commented
  interid = setInterval("tablist['" + block + "'].next()", params[1]);
  //store in - next line commented
  tablist[block].intervalid = interid;
 }
 //handler for tab clicking
 jQuery(block + " .htabs a").click(function(event){
  //store reference to clicked tab
  target = "#"+event.target.getAttribute("href").split('#')[1];
  tblock = "#"+jQuery(target).parent().parent().attr("id");
 
  current[tblock].reference = jQuery(this).attr("href").split('#')[1];
 
  //display referenced tab
  change(tblock);
 
  //if tab is clicked, stop rotating
  clearInterval(tablist[tblock].intervalid);

 
  return false;
 });
 }
 }



function mainmenu(){
$(" #nav ul li ul").css({display: "none"}); // Opera Fix
$(" #nav ul li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(300);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
}

 $(document).ready(function(){					
	mainmenu();
});



//plugin
jQuery.fn.topLink = function(settings) {
	settings = jQuery.extend({
		min: 1,
		fadeSpeed: 200
	}, settings);
	return this.each(function() {
		//listen for scroll
		var el = $(this);
		el.hide(); //in case the user forgot
		$(window).scroll(function() {
			if($(window).scrollTop() >= settings.min)
			{
				el.fadeIn(settings.fadeSpeed);
			}
			else
			{
				el.fadeOut(settings.fadeSpeed);
			}
		});
	});
};

//usage w/ smoothscroll
$(document).ready(function() {
	//set the link
	$('#top-link').topLink({
		min: 400,
		fadeSpeed: 500
	});
	//smoothscroll
});


