	//if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
	 //  location.replace("http://erubash.com/dev/iphone.html");
	//}
	
	
	$(function() {
            $("#wrapper").organicTabs();
     }); 
	
	
	
	 $(document).ready(function() {
		  
		// Tab Icon Panels
		$("#linksTrig").click(function(){
			$("#links").toggle("fast");
			$(this).toggleClass("active");
			return false;
		});
		
		// Tab Icon Panels
		$("#copyTrig").click(function(){
			$("#copy").toggle("fast");
			$(this).toggleClass("active");
			return false;
		});
		
		// Tab Icon Panels
		$("#fbTrig").click(function(){
			$("#facebook").toggle("fast");
			$(this).toggleClass("active");
			return false;
		});
		
		
		
				
		// Expand Panel
		$("#open").click(function(){
			$("#squat").css({"display" : "block"});
			$("div#footWrap").animate( { height:"220px" }, 800 );
			$("div#pageWrap").css({"padding-bottom" : "210px"});
			
			//Address the Icon Panels / Triggers
			$("a#copyTrig").css({"display" : "none"});
			$("#copy").css({"display" : "none"});		
			$("a#copyTrig").removeClass("active");	
			$("a#copyTrig").addClass("trigger");
			
			$("a#linksTrig").css({"display" : "none"});
			$("#links").css({"display" : "none"});		
			$("a#linksTrig").removeClass("active");	
			$("a#linksTrig").addClass("trigger");
			
			$("a#fbTrig").css({"display" : "none"});
			$("#facebook").css({"display" : "none"});		
			$("a#fbTrig").removeClass("active");	
			$("a#fbTrig").addClass("trigger");
		});	
		
		// Collapse Panel
		$("#close").click(function(){
			$("#squat").css({"display" : "none"});
			$("div#footWrap").animate( { height:"55px" }, 500 );	
			$("div#pageWrap").css({"padding-bottom" : "55px"});
			
			//Address the Icon Panels / Triggers
			$("a#copyTrig").css({"display" : "block"});
			$("a#linksTrig").css({"display" : "block"});
			$("a#fbTrig").css({"display" : "block"});
		});		
		
		// Switch buttons from "Open Panel" to "Close Panel" on click
		$("#toggle a").click(function () {
			$("#toggle a").toggle();
		});		
		
		var clearMePrevious = "";
        
        // clear input on focus
        $('.field').focus(function(){
				if($(this).val()==$(this).attr('title')){
					clearMePrevious = $(this).val();
					$(this).val("");
				}
			});
			
		// if field is empty afterward, add text again
		$('.field').blur(function(){
			if($(this).val()==""){
				$(this).val(clearMePrevious);
			}
        });
		
		
		
		// Modal Overlay
	
		//select all the a tag with name equal to modal
		$('a[name=modal]').click(function(e) {
			//Cancel the link behavior
			e.preventDefault();
			
			//Get the A tag
			var id = $(this).attr('href');
		
			//Get the screen height and width
			var maskHeight = $(document).height();
			var maskWidth = $(window).width();
		
			//Set heigth and width to mask to fill up the whole screen
			$('#mask').css({'width':maskWidth,'height':maskHeight});
			
			//transition effect		
			//$('#mask').fadeIn(10000);	<<--- Garbage
			$('#mask').fadeTo(800,0.75);	
			$('#theClose').fadeTo(1200,.99);
			$('#rubash').css('color', '#fff');
			//Get the window height and width
			var winH = $(window).height();
			var winW = $(window).width();
			
			$('.body').css('overflow-y', 'hidden');
			$('.html').css('overflow-y', 'hidden');
				  
			//Set the popup window to center
			$(id).css('top',  winH/2-$(id).height()/2);
			$(id).css('left', winW/2-$(id).width()/2);
		
			//transition effect
			$(id).fadeTo(1200, .95); 
			//$(id).animate( properties, [ duration ], [ easing ], [ complete ] )
			//$(id).animate(".glass", 1000, easeInBounce )
		});
		
		//if close button is clicked
		$('#theClose').click(function (e) {
			//Cancel the link behavior
			e.preventDefault();
			$(this).hide();
			$('#mask').hide();
			$('.window').hide();
			$('.body').css('overflow-y', 'auto');
			$('.html').css('overflow-y', 'auto');
			$('#rubash').css('color', '#666');
		});		
		
		//if mask is clicked
		$('#mask').click(function () {
			$(this).hide();
			$('.window').hide();
			$('.body').css('overflow-y', 'auto');
			$('.html').css('overflow-y', 'auto');
			$('#theClose').hide();
			$('#rubash').css('color', '#666');
		});			
	
	
	

		
			
	});
	
	
	
