// JavaScript Document
$(function(){
	$('#moudleTab').click(
		function(){
			if(this.className=='moudleHidden'){
				this.className='moudleShow';
				$('#box').css('margin-right','0');
				$('#side').css('display','none');
			}else if(this.className=='moudleShow'){
				this.className='moudleHidden';
				$('#box').css('margin-right','348px');
				$('#side').css('display','');
			}
		}
	);
	
	//left height = right side
	var equal = new function(){
		if(document.getElementById('side')){
			var side = document.getElementById('side');
			var box = document.getElementById('box');
			if(parseInt(box.offsetHeight)>parseInt(side.offsetHeight)){			
				side.style.height =box.offsetHeight+'px';
			}else{			
				box.style.height=side.offsetHeight+'px';			
			}			
		}
	};
	//png Filters
	function correctPNG()
	{		
		for(var i=0; i<document.images.length; i++)
		{	
			var img = document.images[i];
			var imgName = img.src.toUpperCase();
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				var imgID = (img.id) ? "id='" + img.id + "' " : "";
				var imgClass = (img.className) ? "class='" + img.className + "' " : "";
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
				var imgStyle = "display:inline-block;" + img.style.cssText;
				if (img.align == "left") imgStyle = "float:left;" + imgStyle;
				if (img.align == "right") imgStyle = "float:right;" + imgStyle;
				if (img.parentNode.href) imgStyle = "cursor:hand;" + imgStyle;
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
				img.outerHTML = strNewHTML ;		
			}
		}
	}
	if ( $.browser.msie ){
		if($.browser.version=='6.0'){correctPNG();};
	}
	//Form Validation 
	var formValid = new function(){
		$('#commentform').find('input[type="text"]').each(function(){			
			$(this).focus(function(){
				$(this).css('border','1px solid #f90');
			}).blur(function(){
				if($(this).val()==''){
					$(this).css('border','1px solid #f00');	
				}else{
					$(this).css('border','1px solid #999');	
				}				
			});
		});
		
		$('#commentform').find('textarea').each(function(){			
			$(this).focus(function(){
				$(this).css('border','1px solid #f90');
			}).blur(function(){
				if($(this).val()==''){
					$(this).css('border','1px solid #f00');	
				}else{
					$(this).css('border','1px solid #999');	
				}				
			});
		});
		$('#commentform').find('#submit').click(function(e){
			$('#commentform').find('input[type="text"]').each(function(i){				
				if($(this).val()=='' && $(this).attr('name')!='url'){
					 $(this).css('border','1px solid #f00');	
					 if(window.event){
		                   window.event.returnValue = false;
		             }else{
		                    e.preventDefault();
		            };
				};
			});
			$('#commentform').find('textarea').each(function(){
				if($(this).val()==''){
					 $(this).css('border','1px solid #f00');	
					 if(window.event){
		                   window.event.returnValue = false;
					 }else{
		                   e.preventDefault();
		             };		            
				};
			});
		});
	};	
	
	// navigation  current state
	var navCurrent= new function(){
		
	}
	 
	
	
});