// JavaScript Document

(function( $ ){
		  
	$.fn.preLoad = function() {
  		 var extAr=$(this).attr('src').split('.');
		var filename=extAr[0];
		var ext=extAr[1];
		var newName=filename+"_h."+ext;
		var image1 = $('<img />').attr('src', newName);
	};

  $.fn.imH = function() {
	 	 var orfile=$(this).attr('src');
  	 	var extAr=$(this).attr('src').split('.');
		var filename=extAr[0];
		var ext=extAr[1];
		if(orfile.indexOf('_h.')>=0){
			var newName=orfile.replace('_h.','.');
		}else{
			var newName=filename+"_h."+ext;
		}
		this.attr('src',newName);
		return this;
  };
  
  
  $.fn.hideArea = function() {
	 	$('a[href="starthide"]').each(function(){
		var $set = $();
		var nxt = this.nextSibling;
		while(nxt) {
			if(!$(nxt).is('a[href="endhide"]')) {
				$set.push(nxt);
				nxt = nxt.nextSibling;
			} else break;
		} 
	   $set.wrapAll('<div class="hiddenArea" />');
	  $(this).hide();
	 $(this).nextAll('a[href="endhide"]:first').data('opentext',$(this).html());
	});
		
		$('a[href="endhide"]').each(function(){
			$(this).data('c',$(this).prev('div.hiddenArea'));
			$(this).data('closetext',$(this).html()).html($(this).data('opentext'));
			$(this).toggle(function(){
				$.docHeight+=$(this).data('c').height()+30;
				$(this).html($(this).data('closetext')).data('c').slideDown('slow',function(){ $(window).delay(1000).resize();});
				$('#fullsizebg').resizenow({minWidth : 1220 , minHeight : 900 , toHeight : $.docHeight});
				
				return false;
		  	},
			function(){
				$.docHeight-=$(this).data('c').height()-30;
				$(this).html($(this).data('opentext')).data('c').slideUp('slow',function(){ $('#fullsizebg').resizenow({minWidth : 1131 , minHeight : 900 , toHeight : $.docHeight}) , $(window).delay(1000).resize();});
				
				return false;
			})
		});
		
		
		$('div.hiddenArea').hide();
  };
  
 
})( jQuery );

