menuButton=null;
$(document).ready(function() {
 

	$("#t_a").css("display", "inline");

	$(".tabLinks").click(function(){

			
			$(".tabContent").css("display", "none");
			idStr =  this.id;
			idStrArray = idStr.split("_");
			tabidstr ="t_" + idStrArray[1];

			 $("#" +tabidstr ).css("display", "inline");
			
			$(".tabLinks").css("background", "url(/images/tabs_bg.gif)");
			 
			$(this).css("background", "url(/images/tabs_bg_active.gif)");
	});
	 
	 
	$("#l_a").css("background", "url(/images/tabs_bg_active.gif)");
	
	

		
	$(".expandingBoxes .btn").click(function(){
											 
									   
									 $(".expandingBoxes .btn").show();
									 $(".readMoreDiv").hide();						
									 $(this).parent().next().show("fast", function(){
																				   
									 curvyCorners.redraw();										   
									 });
								
									 $(this).hide();
									  
									 
								 
	});
 


 










 



$('.print').click(function(){

 	 
  jPrintArea($(this).parent().parent().parent());



});


$('.send').click(function(){


	$(this).parent().parent().parent().mailto();

	
});


 

});

jPrintArea=function(el)
{
	var iframe=document.createElement('IFRAME');
	var doc=null;
	 
 	$(iframe).attr('style','position:absolute;width:0px;height:0px;left:-500px;top:-500px;');
	document.body.appendChild(iframe);
	doc=iframe.contentWindow.document;
		var links=window.document.getElementsByTagName('link');
		for(var i=0;i<links.length;i++)
			if(links[i].rel.toLowerCase()=='stylesheet')
			doc.write('<link type="text/css" rel="stylesheet" href="'+links[i].href+'"></link>');
			doc.write('<div class="'+$(el).attr("class")+'">'+$(el).html()+'</div>');
			doc.close();
			iframe.contentWindow.focus();
			iframe.contentWindow.print();
			 
			document.body.removeChild(iframe);
 
	}


jQuery.fn.mailto = function() {
	var mailto_link = 'mailto:?subject=Optimus Case Study&body='+emailText($(this));

	win = window.open(mailto_link,'emailWindow'); 
	if (win && win.open &&!win.closed) win.close(); 
} 
 
emailText = function(ele){
	 
	txt =ele.html().replace(/\<p\>/g, "");
	txt = txt.replace(/\<\/p\>/g, "%0D");
	txt = txt.replace(/\<\/h6\>/g, "%0D");
	txt = txt.replace(/\<span\>read more\<\/span\>/g, "");
	txt = removeHTMLTags(txt);
	return txt;
}


function removeHTMLTags(str){
 	 	 
 	 	
 		var strTagStrippedText = str.replace(/<\/?[^>]+(>|$)/g, "");
 		return strTagStrippedText;	
 	 }
	 
	 
	 
 
