 $(document).ready(function(){
		var offset_websites=0;
		var offset_photos=0;
		var offset_blog=0;
		var message_ie=0;
			
	//If the User resizes the window, adjust the #container height
	$(window).bind("resize", resizeWindow);


	function resizeWindow( e ) {
		var ph = $(window).height();
		var pl=$(window).width();
		$('#bigbody').css('height', ph - 138).css('width',pl);
	}


jQuery.each(jQuery.browser, function(i, val) {
  if(i=="msie" && jQuery.browser.version=="6.0" && message_ie == 0 )
	{

	$('#pullbox').html("<p>The browser you are using is a very old, insecure and outdated web browser that greatly decreases your web browsing experience..I didn't find enough logic to programmatically counter act all the stupid things this browser is doing to my page.So you can check this site out with latest Firefox or Google Chrome . You can check for the semantic Validity of my site code ,<a href=\"http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fniranjanthilak.com%2F\" >HERE</a>. You can contact me through me@niranjanthilak.com ,for designing and PSD to HTML conversion alike. Also i'm always on twitter @<a href=\"http://twitter.com/niranjan_\">niranjan_</a> . Peace!</p></p>It's recommended that you upgrade to one of the browsers listed below	</p><ul><li><a href=\"http://www.microsoft.com/windows/internet-explorer/default.aspx\" title=\"Download Internet Explorer 8\">Internet Explorer 8</a></li>		<li><a href=\"http://www.mozilla.com/firefox/\" title=\"Download Firefox\">Firefox</a></li>   		<li><a href=\"http://www.google.com/chrome\" title=\"Download Google Chrome\">Google Chrome</a></li> <li><a href=\"http://www.apple.com/safari/download/\" title=\"Download Safari\">Safari</a></li></ul>");
//			alert("Please view this site in Firefox 2.0+ or Google Chrome or IE7+, Firefox 3,5 is recommended ");
			message_ie=1;



}
});

		
	var pt=$('#pullbox').width();	
	resizeWindow();


	$('#pullbox').Resizable(
				{
					minHeight: 138,
					maxHeight: 520,
					minTop: 0,
					minLeft:0,
					maxbottom:20,
					left:0,
					right:0,
					handlers: {
						n: '#pulltop'
					}

				}
			);

	$('#codabox ul.nav li a').click(function(){
		$('#pullbox').css('height','520px').animate({
		top:'-382px'
		});
	});	

$('#needhelp').click(function(){
	$('#a4').click();
});



		
	$('#aboutpull').Resizable(
				{
					minHeight: 90,
					maxHeight: 290,
					handlers: {
						s: '#aboutpull'
					}

				}
			);
			
		

	$('#aboutpull').toggle(function(){
		$(this).animate({
		height:"290px"
		});
	},
	function(){$(this).animate({
		height:"90px"
		});	

	});
	
	$('#port0_1').click( function(){
	offset_websites=0;
	getnextwebport(offset_websites,25);
	});	
	$('#port0_2').click( function(){
	offset_photos=0;
	getnextpicport(offset_photos,26);
	});	
	$('#blog .nextpost').click( function(){
	offset_blog=0;
	getnextblog(offset_blog);
	});	

	
//$('#commentForm').ajaxForm();	
$("#commentForm").validate({
errorLabelContainer: "#replyfield",
   wrapper: "div",   
 
rules: {
     // simple rule, converted to {required:true}
    cname: "required",
     // compound rule
     cemail: {
       required: true,
       email: true
}
}
,
   messages: {
     cname: "Your name? .",
     cemail: {
       required: "Forgot email ?",
       email: "'email' is something like name@domain.com"
     },	 
     curl: "Your website? .",	 
     ccomment: "You gotta say something right? ."
	}
,
	submitHandler: function() {
			
            $('#replyfield').show(); 
	$('#replyfield').html($('#ajaxload').html());
	$('#commentForm').ajaxSubmit({ 
        // target identifies the element(s) to update with the server response 
        target: '#replyfield', 
 
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() { 
            $('#replyfield').show(); 
			$('#commentForm').clearForm();
			$('#commentForm').resetForm();
        } 
    }); 
	}
});


});	
	
	
	
	
	
	
	
function getnextblog(off){
	$('#blog #post1').fadeOut(300,function(){
			$('#blog #post1').html($('#ajaxload').html());
			$('#blog #post1').fadeIn(300,function(){	
				$('#tempajax').load("http://niranjanthilak.com/getsinglepost/?cat=-24&off="+off, function(){
					$('#blog #post1').fadeOut(300,function(){								
						$('#post1').html($('#tempajax .postbox').html());  
						$('#post1').html( $('#post1').html());
							$('#post1').html($('#post1').html() + "<div class=\"nextpost righty\"></div>" );
						if( off!=0 )
							$('#post1').html($('#post1').html() + "<div class=\"prevpost righty\"></div><p class=\"clearings\"></p>");
									$('#blog .nextpost.righty').bind("click",function(){
							off++;
							getnextblog(off);
						});
						$('.prevpost.righty').bind("click",function(){
							off--;
							getnextblog(off);
						});
						$('#blog #post1').fadeIn(300);
					});
				});
			});
		});
}

function getnextpicport(off,wich){
		if( off <0 )
			off=0;
		$('#port1').fadeOut(300,function(){
			$('#port1').html($('#ajaxload').html());
			$('#port1').fadeIn(300,function(){		
				$('#tempajax').load("http://niranjanthilak.com/getsinglepost/?cat="+wich+"&off="+off, function(){
					$('#port1').fadeOut(300,function(){		
						$('#port1').html($('#tempajax .photopost').html());  
						//if( off!=5 )
							$('#port1 .photomatter').html($('#port1 .photomatter').html() + "<div class=\"nextpost righty\"></div>" );
						if( off!=0 )
							$('#port1 .photomatter').html($('#port1 .photomatter').html() + "<div class=\"prevpost righty\"></div><p class=\"clearings\"></p>");

							$('#port1 .photopic a').lightBox();
						$('.nextpost.righty').bind("click",function(){
							off++;
							getnextpicport(off,wich);
						});
						$('.prevpost.righty').bind("click",function(){
							off--;
							getnextpicport(off,wich);
						});
						$('#port1').fadeIn(300);
					});
				});
			});
		});
}

function getnextwebport(off,wich){
		if( off >5  || off <0 )
			off=0;
			$('#port1').fadeOut(300,function(){
					$('#port1').html($('#ajaxload').html());
					$('#port1').fadeIn(300,function(){			
						$('#tempajax').load("http://niranjanthilak.com/getsinglepost/?cat="+wich+"&off="+off, function(){
							$('#port1').fadeOut(300,function(){		
								$('#port1').html($('#tempajax .postbox .postcontent').html());
								if( off!=5 )
									$('#port1 .webright').html($('#port1 .webright').html() + "<div class=\"nextpost righty\"></div>" );
								if( off!=0 )
									$('#port1 .webright').html($('#port1 .webright').html() + "<div class=\"prevpost righty\"></div><p class=\"clearings\"></p>");
									
									$('#port1 .webshots a').lightBox();
								$('.nextpost.righty').bind("click",function(){
									off++;
									getnextwebport(off,wich);
								});
								$('.prevpost.righty').bind("click",function(){
									off--;
									getnextwebport(off,wich);
								});					
							});
							$('#port1').fadeIn(300);														
						});
					});
			});
			
			
}
	
	