// skin js START
////////////////////////////////////////////////////////////////////////////////////////////////
// functions


function resizeModuleGroupFunction() //function to resize the moduleGroups to the same hight
{
	jQuery('.moduleGroup').each(function(){
		resizeModuleGroup(this);
	});

	function resizeModuleGroup(moduleGroupElement) {
		var groupHeight = jQuery(moduleGroupElement).height();
		if (jQuery(moduleGroupElement).children('.module:not(.unframed)').size() > 1) {
			jQuery(moduleGroupElement).children('.module:not(.unframed)').each(function(){
//				var moduleHeaderHeight = jQuery(this).children('.moduleHeader').outerHeight(true);
//				var moduleFooterHeight = jQuery(this).children('.moduleFooter').outerHeight(true);
				var moduleBodyWrapHeight = groupHeight /*- moduleHeaderHeight - moduleFooterHeight;*/
				jQuery(this).children('.moduleBodyWrap').height(moduleBodyWrapHeight + 'px');
			});
		}
	}
}


jQuery(document).ready(function(){
	jQuery.fn.sizeHeight = function(wHeight){
		// Product container height
		var headerHeight = jQuery('#header').height();
		var footerHeight = jQuery('.centralize').height();
		var contentHeight = jQuery('#contentBlock-1').height();
		var navigationHeight = jQuery('#subMmain').height();
		var pixelDazu = 80;
	
		if(contentHeight > navigationHeight) {
			var temp = contentHeight;
		}
		else {
			var temp = navigationHeight;
		}
		
		var navigationHeight = wHeight-headerHeight-footerHeight;
		var footerPosition = headerHeight+temp;
		var totalSize = headerHeight+temp+footerHeight;
		
		
	
		if(wHeight<totalSize){
			jQuery('.centralize').css('position','relative');
			jQuery('.centralize').css('top','50px');
			jQuery('#pageWrap').css('height', totalSize+pixelDazu+'px');
		}
		
		else if(wHeight>totalSize){
			jQuery('.centralize').css('position','fixed');
			jQuery('.centralize').css('bottom','0');
			jQuery('.centralize').css('top','');
			jQuery('#generatedContent-1').css('height',navigationHeight+'px');
			//jQuery('#f1d #pageContent').css('height','100%');
		}
	}
	

	jQuery(function(){
		jQuery().sizeHeight(jQuery(this).height());
	});
	
	jQuery(window).resize(function () {
		jQuery().sizeHeight(jQuery(this).height());
	});	
	
});









function jQueryUniform() //function for nicer forms
{   
	jQuery("input, textarea, select").uniform();
}

function iconSet()
{
	jQuery('a[hrefjQuery=".pdf"]').addClass("pdf");
	jQuery('a[hrefjQuery=".doc"]').addClass("doc");
	jQuery('a[hrefjQuery=".docx"]').addClass("doc");
	jQuery('a[hrefjQuery=".xls"]').addClass("excel");
	jQuery('a[hrefjQuery=".ppt"]').addClass("powerpoint");
	jQuery('a[hrefjQuery=".txt"]').addClass("txt");
	jQuery('a[hrefjQuery=".rtf"]').addClass("txt");
	jQuery('a[hrefjQuery=".zip"]').addClass("zip");
	jQuery('a[hrefjQuery=".rar"]').addClass("zip");
	jQuery('a[hrefjQuery=".bin"]').addClass("zip");
	jQuery('a[hrefjQuery=".jpg"]').addClass("picture");
	jQuery('a[hrefjQuery=".jpeg"]').addClass("picture");
	jQuery('a[hrefjQuery=".png"]').addClass("picture");
	jQuery('a[hrefjQuery=".gif"]').addClass("picture");
	jQuery('a[href*="Mailto"]').addClass("mailto");
	jQuery('a').filter(function() {
	    return this.hostname && this.hostname !== location.hostname;
	}).addClass("external");

	jQuery('a:has(> img)').removeClass("pdf doc excel powermoint txt zip mailto picture");
	jQuery('a:has(> img)').addClass("hasNoBorder");
}

function fancyBoxes()
{	
	// Image
	jQuery("a.lightbox").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': true,
	});

	// iFrame Content
	jQuery("a.lightbox-page").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': true,
		'width': 650,
		'height': 280,
		'titleShow': false,
		'autoScale' : true,
		'type': 'iframe'
	});
}

function clearFormInputText() // Clear default search text on click
{	
	jQuery('#siteSearchInput, .tx-indexedsearch-searchbox-sword').clearOnFocus();
}


// load all jQuery ready functions
//jQuery(document).ready(function()
//{
//	// load functions here
//	//resizeModuleGroupFunction();
//   // jQueryUniform();
 //	iconSet();
//   // fancyBoxes();
//   // clearFormInputText();
//  jQuery().sizeHeight();
//  
		


//});


jQuery(window).scroll(function()
{
	// load functions here
});

// skin js END
////////////////////////////////////////////////////////////////////////////////////////////////
