$(document).ready(function(){
						   
						   //alert("im here");
						   //make my curvey corners
						   $('.curveycorners').wrapInner('<div class="curveycontent" />');
						   
	$('.curveycorners').each(function(){
									  Haddon=0;
									  if($(this).css("padding-top")){
										  Haddon=Haddon+parseInt($(this).css("padding-top"));
									  }
									   if($(this).css("padding-bottom")){
										  Haddon=Haddon+parseInt($(this).css("padding-bottom"));
									  }
									
									  myright=$(this).width()-10;
									  myheight=$(this).height()-10+Haddon;
									  
	$(this).append("<div class='tops' style='top:0px;left:0px;width:"+(myright+10)+"px'></div><div class='bottoms' style='top:"+myheight+"px;left:0px;width:"+(myright+10)+"px'></div><div class='lefts' style='top:0px;left:0px;height:"+(myheight+10)+"px'></div><div class='rights' style='top:0px;left:"+myright+"px;height:"+(myheight+10)+"px'></div><div class='topleftcorner' style='top:0px;left:0px'></div><div class='toprightcorner' style='top:0px;left:"+myright+"px'></div><div class='bottomrightcorner' style='top:"+myheight+"px;left:"+myright+"px'></div><div class='bottomleftcorner' style='top:"+myheight+"px;left:0px'></div>");

									  });
	
	
	//newsflash
	
	
	function startnews(whichnews){
		if(whichnews+1>=$(".newsitem").length){
			nextnews=0;
			
		} else {
			nextnews=whichnews+1;
		}
		$(".newsitem").eq(whichnews).animate({"opacity":"1"},{queue:false, duration:750});
		$(".newsitem").eq(whichnews).animate({"top":"0px"},{queue:false, duration:2500,complete:function(){
																										 
																				pausenews(nextnews);						 
																										 }
																										 });
		//alert("im moving "+whichnews);
		
		$(".newsitem").each(function(){
									// alert("in start of function"+nextnews);
									 nextnews=nextnews;
					if($(this).css("top")!="400px"	){
						//alert($(this).css("top"));
						$(this).animate({"top":"-400px"},{queue:false, duration:2500,complete:function(){
																							$(this).css("top","400px");
																							//alert(nextnews);
																							//startnews(nextnews);
																									  }
																									  });
						$(this).animate({"opacity":"0"},{queue:false, duration:750});
						
					}
									 
	});
		
		
	}
	
	function pausenews(whichpass){
		$("#newsbox").animate({"top":$("#newsbox").css("top")},{queue:false, duration:10000, complete:function(){
																											startnews(whichpass);  
																											  }
																											  });
	}
	
	//startnews(0);
	
	function startnewnews(whichnews){
		//alert("here is whichnews plus 1"+intval(whichnews+1+"here is news length"+$(".news").length);
		if(whichnews+1>=$(".news").length){
			//alert("here is whichnews plus 1"+whichnews+1+"here is news length"+$(".news").length);
			nextnews=0;
			
		} else {
			nextnews=whichnews+1;
			//alert(nextnews);
		}
		$(".news").eq(whichnews).animate({"opacity":"1"},{queue:false, duration:750});
		$(".news").eq(whichnews).animate({"top":"25px"},{queue:false, duration:2500,complete:function(){
																										 
																				pausenewnews(nextnews);						 
																										 }
																										 });
		//alert("im moving "+whichnews);
		
		$(".news").each(function(){
									// alert("in start of function"+nextnews);
									 nextnews=nextnews;
					if($(this).css("top")!="400px"	){
						//alert($(this).css("top"));
						$(this).animate({"top":"-400px"},{queue:false, duration:2500,complete:function(){
																							$(this).css("top","400px");
																							//alert(nextnews);
																							//startnews(nextnews);
																									  }
																									  });
						$(this).animate({"opacity":"0"},{queue:false, duration:750});
						
					}
									 
	});
		
		
	}
	
	function pausenewnews(whichpass){
		//alert("got in pause"+whichpass);
		$("#headsection").animate({"top":"0px"},{queue:false, duration:10000, complete:function(){
																									   //alert("got in pause complete and whichpass="+whichpass);
																											startnewnews(whichpass);  
																											  }
																											  });
	}
	
	//startnewnews(0);
	
	
	//start project showing scripts
	
	$(".spd").click(function(){
							 passer=$(".spd").index(this);
							 doproject(passer);
							
				
							
							});
	
	function doproject(whichproject){
		extrapad=20;
		if($(".fullprojectholder").eq(whichproject).height()>10){
		$(".spd").eq(whichproject).html("see project details [+]");
			$(".fullprojectholder").eq(whichproject).animate({"height":"0px"},{queue:false, duration:1000});
		} else {
		
		$(".spd").eq(whichproject).html("hide project details [-]");
		$(".fullprojectholder").eq(whichproject).animate({"height":($(".fullproject").eq(whichproject).height()+extrapad)+"px"},{queue:false, duration:1000});
		
		}
		
	}
	
	
});
