$(document).ready(function(){
	if(!$.browser.msie){ var isIE = '1'; };
		$('.jshide').show();

	var uploadformz = '<form enctype="multipart/form-data" action="" method="POST" id="upform"><fieldset><label for="uemail"><strong>Email</strong><span> (required)</span></label><input id="uemail" name="uemail" class="name_text" /></fieldset><fieldset><label for="uname"><strong>Name</strong><span> (required)</span></label><input id="uname" name="uname" class="name_text" /></fieldset><fieldset><label for="ufile"><strong>Image</strong></label><input type="file" id="ufile" name="ufile" class="fi" /></fieldset><input type="hidden" name="MAX_FILE_SIZE" value="100000" /><input type="submit" accesskey="s" name="uploadgo" id="comment-post" value="Upload Image" /></form>';
	$('#uploadformd').empty().html(uploadformz);
	
	//MenuAnimation and ImageGalleryHover
	if(isIE){
		$('.menu li a').hover(
			function(){
				$(this).animate({ backgroundColor: '#FF3600' }, 400).animate({ backgroundColor: '#FFD800', color: '#222222' }, 400); },
			function(){
				var currentclass = $(this).attr('class'); var col1 = '#555555'; var col2 = '#FFFFFF';
				if(currentclass=='active'){ col1 = '#FFD800'; var col2 = '#222222'; };
				$(this).animate({ backgroundColor: col1, color: col2 }, 400);
			}
		);
	}	
	$('#maincontent ul li a').hover( function(){ $(this).children(".imginfo").fadeOut(300); }, function(){ $(this).children('.imginfo').fadeIn(300); } );
	
	//DetailPage
	var bidivwidth = $('#bigimg').width();
	var biiwidth = $('#bigimg img').width();
	var biiheight = $('#bigimg').height();
	var bisze = '<span>' + biiwidth + ' &times; ' + biiheight + ' px';
	if(biiwidth>bidivwidth){
		var newheightBI = biiheight * ( bidivwidth / biiwidth ); newheightBI = Math.ceil(newheightBI);
		$('#bigimg img').css({'width':bidivwidth,'height':newheightBI});
		var bisze = bisze + ' (resized to fit)';
	}
	var bisze = bisze + '</span>';
	$('#idetsize').append(bisze);
	
	//validate form on keyup and submit
	$("#upform").validate({
		rules: {
			uname: "required",
			uemail: {
				required: true,
				email: true
			},
			ufile: "required"
		},
		messages: {
			uname: "Please enter your name",
			uemail: "Please enter a valid email address",
			ufile: "Please select a file"
		}
	});

});