$(document).ready(function() {			
		
		/*$('img.source-image').maxImage({
        isBackground: true,
        overflow: 'auto',
		horizontalOffset: 10,
		verticalOffset: 0,
		maxFollows: 'width',
		verticalAlign: 'top'
		});*/
						   
//---------------------------image width and height--------------------------------------------------------------------//
		var imageWidth = $(".source-image").width();
		var imageHeight = $(".source-image").height();
		//alert(imageWidth + " : " + imageHeight +" : "+ $winwidth +" : " + $winheight);	
		$("img.source-image").css({'position' : 'fixed', 'left':'0px', 'top': '0px'});	
		
	
		function resizeObj(){
			
		var testDimen = resizeDimension(1231,797);
			//$(".fullImage").css({'height':testDimen[1]+'px'});
			$(".source-image").css({'width':testDimen[0]+'px','height':testDimen[1]+'px'});
		
		
		
		
		
		//-----------menu---------------------------------------------------------------------------------------------//
			$subMenuLinks = $("#subMenu a.linkAnchor");
			$subMenuDivs = $("#subMenu div.subMenuBox");
			$("#subMenu").hide();
			$("#subMenu div.subMenuBox").hide();
		
			//alert($subMenuLinks.length)
			//alert($($subMenuDivs[0]).html())
			var activeSubMenuId;
			$subMenuLinks.each(function(e){
				this._id = e;
				
				$(this).hover(function(){
					//if(activeSubMenuId){
						$($subMenuDivs[activeSubMenuId]).hide();	
					//}
					activeSubMenuId = this._id;
					$($subMenuDivs[this._id]).show();
					//alert($(this).html())
				})
				
			});
			//$(".topNav li:has(ul)").each(function(e){
			$("li.subMenuLi").each(function(e){													
				if(e==0){
					$(this).hover(function(){
						$("#subMenu").show();
						$($subMenuDivs[activeSubMenuId]).hide();	
					})
				}else{
					$(this).hover(function(){$("#subMenu").hide(); $($subMenuDivs[activeSubMenuId]).hide();		})
				}
			})
	
			$("#dnn_contentPane,.logo,#menuBlock,#wrapper,.container").hover(function(){
				$("#subMenu").hide();
				$($subMenuDivs[activeSubMenuId]).hide();	
			 });			
					
			       
          //---------- Bottom footer---------------------------------------------------------------- //
			var docHeight = $("#wrapper").height();			
			//alert("window height=" + $(window).height() + " docheight=___" + docHeight);
			
			if(docHeight < $(window).height()){			
				 var diff = $(window).height() - docHeight;
				 
				//alert("window height=" + $(window).height() + " docheight=" + docHeight + " diff=" + diff );
				 
				  if (!$("#sticky-footer-push").length > 0) {
					$("#btmBlock").before('<div id="sticky-footer-push"></div>');
					  }
				  $("#sticky-footer-push").height(diff);
				  
			  } ;
			  
			  
			}
		
//------------------------------Resize image-------------------------------------------------------------------------- //

		function resizeDimension(__iniWidth,__iniHeight,maxWidth,maxHeight,isCrop){
			if(!maxWidth) maxWidth = $(window).width();
			if(!maxHeight) maxHeight = $(window).height();
			isCrop = true;
			
			var __width;
			var __heigh;
			
			/*	
			if(maxWidth<=maxHeight){
				__width = maxWidth;
				var scale = __width/__iniWidth;
				__height = __iniHeight * scale;
				
				if(__height<maxHeight && isCrop){
					scale = (maxHeight-__height)/__height;
					__height = maxHeight;
					__width += scale*__width;
				}
			}else{
				__height = maxHeight;
				var scale = __height/__iniHeight;
				__width = __iniWidth * scale;	
				if(__height<maxWidth && isCrop){
					scale = (maxWidth -__width)/__width;
					__width = maxWidth;
					__height += scale*__height;
				}
			}
			*/
				__width = maxWidth;
				var scale = __width/__iniWidth;
				__height = __iniHeight * scale;
				
				if(__height<maxHeight && isCrop){
					scale = (maxHeight-__height)/__height;
					__height = maxHeight;
					__width += scale*__width;
				}
			
			
			return [__width,__height];
		}

		$(window).resize(function(){
			resizeObj();
		});
		resizeObj();
});

