//var jQ = jQuery.noConflict();

jQuery(function(){
	   if (document.location.href.indexOf('?s=') > 0)
		jQuery(".entry-meta").hide();
		jQuery(".comments-link").hide();
});

jQuery(function(){
	   if (document.location.href.indexOf('/about/') < 0)
		jQuery(".homehider").remove();
});

jQuery(document).ready(function() {	

	//select all the area tag with name equal to modal
	jQuery('area[name=modal],a.modal').mouseover(function(e){
		//Cancel the link behavior
		e.preventDefault();
		//Get the A tag
		var id = jQuery(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = jQuery(document).height();
		var maskWidth = jQuery(window).width();
	
		//Set height and width to mask to fill up the whole screen
		jQuery('#mask1').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		jQuery('#mask1').fadeIn(250);	
		jQuery('#mask1').fadeTo("slow",0.30);	
	
		//Center the window no matter where its at
		//jQuery(window).CenterIt();
		
		//Get the window height and width
		var winH = jQuery(window).height();
		var winW = jQuery(window).width();
              
		//Set the popup window to center
		jQuery(id).css("position", "fixed");
		jQuery(id).css('top',  winH/2-jQuery(id).height()/2);
		jQuery(id).css('left', winW/2-jQuery(id).width()/2);
		
		//transition effect
		jQuery(id).fadeIn(250); 
	
	});
	
	//if close button is clicked
	jQuery('.window1 .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		jQuery('#mask1, .window1').hide();
	});		
	
	//if mask is clicked
	jQuery('#mask1').click(function () {
		jQuery(this).hide();
		jQuery('.window1').hide();
	});
	
	//show all button
	jQuery('.showit').click(function(){

		jQuery(".window1").show().css({
		'position':'static',
		'width':'650px',
		'max-height' : '500px',
		'margin-bottom':'20px'
		});
	
	});
		
});
// jquery ui initialization

jQuery(function(){

	// Accordion
	jQuery('#accordion').accordion({ 
		header: ".expandit",
		collapsible: true, 
		autoHeight: false, 
		active: false 
	});

	// Tabs
	jQuery('#tabs').tabs();


	// Dialog			
	jQuery('#dialog').dialog({
		autoOpen: false,
		width: 600,
		buttons: {
			"Ok": function() { 
				jQuery(this).dialog("close"); 
			}, 
			"Cancel": function() { 
				jQuery(this).dialog("close"); 
			} 
		}
	});
	
	// Dialog Link
	jQuery('#dialog_link').click(function(){
		jQuery('#dialog').dialog('open');
		return false;
	});

	// Datepicker
	jQuery('#datepicker').datepicker({
		inline: true
	});
	
	// Slider
	jQuery('#slider').slider({
		range: true,
		values: [17, 67]
	});
	
	// Progressbar
	jQuery("#progressbar").progressbar({
		value: 20 
	});
	
	//hover states on the static widgets
	jQuery('#dialog_link, ul#icons li').hover(
		function() { jQuery(this).addClass('ui-state-hover'); }, 
		function() { jQuery(this).removeClass('ui-state-hover'); }
	);
	
});


