$('document').ready(function() {
	
	var path = "";
	var href = document.location.href;
	var s = href.split("/");
	for (var i=2;i<(s.length-1);i++) {
		var cleanse = s[i];
		if(i==2) {
			path+="<A HREF=\""+href.substring(0,href.indexOf("/"+s[i])+s[i].length+1)+"/\" class=\"breadlink"+i+"\">"+"home"+"</A>  ";
		} else {
	path+="<span class='raquo"+i+"'>&raquo;</span> <A HREF=\""+href.substring(0,href.indexOf("/"+s[i])+s[i].length+1)+"/\" class=\"breadlink"+i+"\">"+cleanse+"</A>  ";
		}
	}
	i=s.length-1;
	var cleanse2 = s[i];
	var newName = cleanse2.split(".");
	var cleanse3 = newName[0];
	var extra = cleanse2.split("=");
	var final = extra[1];
	
	path+="<span class='raquo"+i+"'>&raquo;</span> <A class=\"breadlink"+i+"\" HREF=\""+href.substring(0,href.indexOf(s[i])+s[i].length)+"\">"+cleanse3+"</A>";
	
	var mad = href.indexOf("madlib/madlib");
	var res = href.indexOf("madlib/result");
	
	// for xxx.php?t=12 
	if($("body").hasClass("tele")|| mad > -1 || res > -1) {
		path += "<span class='raquoFinal'>&raquo;</span><a class='breadlinkFinal' href='"+ cleanse2 + "'>"+ final + "</a>";
	}
	
	
	var url = path;
	$("#trail .bread").append(url);
	//document.writeln(url);
	
	
	
});



var windowWidth=screen.width;
var windowHeight= screen.height;
function myPopup(url,windowname){
window.open(url,windowname,"resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=no,width="+windowWidth+",height="+windowHeight+",left='0',top='0'");
}

var root = "http://corbdesign.com";

$('document').ready(function() {
				
/* nav trail ///////////////////////////////////////////////////////// */		



/* tabs ////////////////////////////////////////////////////////////////////////// */
	/*tabs*/
	var initial = window.location.href;
		//alert(url);
	var nohttp = initial.split('//')[1]; 
		//alert(nohttp);
	var hostPort = nohttp.split('/')[1];
		//alert (hostPort); // gives "Corb"
	var tab = hostPort.split('.')[0];
		//alert (tab); // gives "Corb"
	var root = tab.split('/')[0];
		//alert(root); // if more than one directory

	$("#nav > a").each(function() {
	   $(this).removeClass("current");
	   if($(this).attr("id") == root) {
			   $(this).addClass("current");
	   }
	});
	
	// which page
	
	
	/*trail */
	var first = initial.split('//')[1];
	//alert(first);
	var myArray = first.split('/');
	//alert(myArray);
	for (var i=1; i<myArray.length-1; i++) {
		//alert(i);
		var path = "";
		var thisOne = myArray[i];
		//alert(thisOne);
		if(i==1) {var path = "/";}
		else if (i==2) {var path = "/"+myArray[1]+"/"; }
		else if (i==3) {var path = "/"+myArray[1]+"/"+myArray[2]+"/";}
		else if (i==4) {var path = "/"+myArray[1]+"/"+myArray[2]+"/"+myArray[3]+"/";}
		else {var path="/";}
		//do dynamically - get i, and subtract from array.length-2. if 0, i-1 = num of array[i] to loop thru
		// the above is false... just do this statically for up to 5
		var append = "&raquo; <a href=\"http://corbdesign.com"+path+myArray[i]+"/\">"+myArray[i]+"</a>";
		//$("#trail").append(append);
	}
var yaba = first.split('/');
	var len=yaba.length-1;
	var last = yaba[len];
	var page = last.split('.')[0];
	var num = last.split('=')[1];
	//alert(page); alert(num);
	
	if(page && num) {
	var appendIt = "&raquo; <a href='#'>"+page+"-"+num+"</a>";
	}
	else {
		var appendIt = "&raquo; <a href='#'>index</a>";
	}
	//$("#trail").append(appendIt);
	
	$("#trail .bread a.breadlink2").html("home");
	$("#trail .bread a").each(function(){
		if($(this).html() == "") {$(this).html("index")}
	});
	$("#trail .bread span.raquo2").hide();
	
	var newHeight = $("#leftness").height();
	//alert(newHeight);
	//$("#right_about").css("height", newHeight);
	
	$(".showHide a").click(function() {$("#desc").toggle('slow');});
	$("#menuToggle a").click(function() {
		 var state=$("#right_about").css('display');	
			if (state=="block") {
				$("#text").html("+ show");	
			}
			else  $("#text").html("- hide");	
			//$("#right_about").toggle('slow'); 
			
	 });
	var footerness = "hi!";
		//"weeeeeee&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;weeeeeee";
		$("#clearness").html("<div id=\"bottom_dog\"></div>");
		$("#top_dog").html("<div id=\"top_image\"></div>");
		
		$("#menuToggle a").toggle(
			function() {
			
				$("#yup").animate({ width: 948}, 700);
				//$("#right_about").animate({width:0, opacity:0}, 1000);
				$("#right_about").toggle(600);
				$('#top_dog').animate({backgroundPosition: '254px 0px'}, {duration:700});
				$('#clearness').animate({backgroundPosition: '254px 0px'}, {duration:700});
				
			},
			function() {
				
				$("#yup").animate({ width: 694}, 700);
				//$("#right_about").animate({width:240, opacity:1}, 1000);		
				$("#right_about").toggle(1200);
				$('#top_dog').animate({backgroundPosition: '0px 0px'}, {duration:700});
				$('#clearness').animate({backgroundPosition: '0px 0px'}, {duration:700});
			}
			
		);
		

		var whichPage = "<?php echo $thisPage ?> ";
	if(whichPage!="" || whichPage != "null" || whichPage!= "NULL" || whichPage != " ") {
		if($("#"+whichPage)) {
	$("#"+whichPage).addClass("this");
		}
	}
	
});


$('document').ready(function() {

//windowWidth = $(window).width();
//windowHeight = $(window).height();
	

$("#right_about  span, .toggler").each(function() {
	$(this).click(function() {
		var id=$(this).attr("id");
		var lengthy = id.length-3;
		//alert(lengthy);
		var newId = id.substring(0, lengthy);
		//alert(newId);
		var selector="\"#"+newId+"\"";
		$("#"+newId).toggle('slow');
	});	 
});



/* //////////////// document stuff ////////// */
var url = window.location.href;
//alert(url);
var tot = url.length;
//alert(tot);
var page = url.substring(26, tot);
//alert(page);
// substring again till you find a  "." or a "/" to determine main navigation highlight

});




