 IE4 = (document.all)? true:false
  NS4 = (document.layers)? true:false
 NS6 = (document.getElementById && !(document.all))? true:false

whereX = 0;
whereY = 0;

 
imgarray = document.images 

function preloader(){ 

   for (i=0; i <= imgarray.length -1; i++) { 
     imgname = imgarray[i].name 
     imgsrc = imgarray[i].src 
     
     //alert(imgsrc)

     if (imgsrc.search("_off") != -1) { 

        rollimgname = imgname + "_on"
        rollimgname = new Image();

        rollimgsrc = imgsrc.replace("_off","_on") 
        rollimgname.src = rollimgsrc

        
        selimgname = imgname + "_sel"
        selimgname = new Image();

        selimgsrc = imgsrc.replace("_off","_sel") 
        selimgname.src = selimgsrc 

     } 

   } 
 } 


function pageloader(imgName){

	if (NS4)
	    theImg = document.images[imgName]; //document.layers['include'].document.images[imgName];
	else
		theImg = document.images[imgName];

    srcStr = theImg.src;

	
if (srcStr.search("_off") != -1){
	theImg.src = eval ("'"+srcStr.replace("_off","_sel")+"'");
}

if (srcStr.search("_on") != -1){
	theImg.src = eval ("'"+srcStr.replace("_on","_sel")+"'");
}
}

  
function flip(imgName){


	if (NS4)
	    theImg = document.images[imgName]; //document.layers['include'].document.images[imgName];
	else
		theImg = document.images[imgName];

    srcStr = theImg.src;

	
if (srcStr.search("_off") != -1){
	theImg.src = eval ("'"+srcStr.replace("_off","_on")+"'");
}

if (srcStr.search("_on") != -1){
	theImg.src = eval ("'"+srcStr.replace("_on","_off")+"'");
}
	  
//
// if (srcStr.search("_sel") != -1){
	//theImg.src = eval ("'"+srcStr.replace("_sel","_selon")+"'");
//}

// if (srcStr.search("_selon") != -1){
	// theImg.src = eval ("'"+srcStr.replace("_selon","_sel")+"'");
//}

	    
//pageloader();

  }
  
function off(imgName){

	if (NS4)
	    theImg = document.images[imgName]; //document.layers['include'].document.images[imgName];
	else
		theImg = document.images[imgName];

    srcStr = theImg.src;


if (srcStr.search("_on") != -1){
	theImg.src = eval ("'"+srcStr.replace("_on","_off")+"'");
}
}  

function on(imgName){

	if (NS4)
	    theImg = document.images[imgName]; //document.layers['include'].document.images[imgName];
	else
		theImg = document.images[imgName];

    srcStr = theImg.src;

	
if (srcStr.search("_off") != -1){
	theImg.src = eval ("'"+srcStr.replace("_off","_on")+"'");
	

 //alert (pageola);	
}


}

function openWindow(url, targ, w, h) {
    var options = "width=" + w + ",height=" + h + ",";
    options += "resizable=yes,scrollbars=yes,status=no,";
    options += "menubar=no,toolbar=no,location=no,directories=no,";
    var newWindow = window.open(url, targ, options);
    newWindow.focus();
  }

  
function layerPopup (layerName){
 IE4 = (document.all)? true:false
  NS4 = (document.layers)? true:false
 NS6 = (document.getElementById)? true:false

    if(IE4){
   for(i=0; i<document.all.length; i++){
   if (document.all[i].id.substr(0,5) == "layer")
    document.all[i].style.visibility="hidden";
  }
  document.all[layerName].style.visibility = "visible"
 } else if (NS4){
  for(i=0; i<document.layers.length; i++){
  if (document.layers[i].id.substr(0,5) == "layer")
   document.layers[i].visibility = "hide";
     }
  document.layers[layerName].visibility = "show";
    } else if (NS6){
   for(i=0; i<document.getElementsByTagName("*").length; i++){
   if (document.getElementsByTagName("*")[i].id.substr(0,5) == "layer")
    document.getElementsByTagName("*")[i].style.visibility="hidden";
  }
  document.getElementById(layerName).style.visibility = "visible"
 }
}



  
function sidePopup (layerName){
 IE4 = (document.all)? true:false
  NS4 = (document.layers)? true:false
 NS6 = (document.getElementById)? true:false

    if(IE4){
   for(i=0; i<document.all.length; i++){
   if (document.all[i].id.substr(0,4) == "side")
    document.all[i].style.visibility="hidden";
  }
  document.all[layerName].style.visibility = "visible"
 } else if (NS4){
  for(i=0; i<document.layers.length; i++){
  if (document.layers[i].id.substr(0,4) == "side")
   document.layers[i].visibility = "hide";
     }
  document.layers[layerName].visibility = "show";
    } else if (NS6){
   for(i=0; i<document.getElementsByTagName("*").length; i++){
   if (document.getElementsByTagName("*")[i].id.substr(0,4) == "side")
    document.getElementsByTagName("*")[i].style.visibility="hidden";
  }
  document.getElementById(layerName).style.visibility = "visible"
 }
}




function insidePopup (layerName){
 IE4 = (document.all)? true:false
  NS4 = (document.layers)? true:false
 NS6 = (document.getElementById)? true:false

    if(IE4){
   for(i=0; i<document.all.length; i++){
   if (document.all[i].id.substr(0,6) == "inside")
    document.all[i].style.visibility="hidden";
  }
  document.all[layerName].style.visibility = "visible"
 } else if (NS4){
  for(i=0; i<document.layers.length; i++){

   if (document.layers[i].id.substr(0,6) == "inside")
   document.layers[i].visibility = "hide";
     }
  document.layers[layerName].visibility = "show";
    } else if (NS6){
   for(i=0; i<document.getElementsByTagName("*").length; i++){
   if (document.getElementsByTagName("*")[i].id.substr(0,6) == "inside")
    document.getElementsByTagName("*")[i].style.visibility="hidden";
  }
  document.getElementById(layerName).style.visibility = "visible"
 }
}
  


function printbutton() {

	if (window.print) {
    	window.print();
	}

	else {
	alert ("Your browser does not support this method of printing. Please select Print from the File Menu (Ctrl+P ) Windows (Apple+P Mac)");
	}
}



 function adjustScreenSize() {
   var windowWidth = window.screen.availWidth;
   var windowHeight = window.screen.availHeight;
   top.window.resizeTo(windowWidth,windowHeight);     
   top.window.moveTo(0,0);
}


function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}



function getCookie(NameOfCookie){ 


//alert(document.cookie);


if (document.cookie.length > 0) 
{ begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) 
{ begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 
}


function setCookie(NameOfCookie, value, expiredays) 
{ var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString())
+ "; domain=gjordan.dyndns.org; path=/CC;";
}




function delCookie (NameOfCookie) 
{ if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

}



function DoTheCookieStuff()
{
var Preference=getCookie('crumSize');
if (Preference!=null) {
	 //alert('Hi - your prefered size is '+Preference)
	 //alert (Preference);
	 setActiveStyleSheet(Preference+' Text');return false;
}
	 
	 
	 
// Since this is a samplepage you are not taken to the prefered page.
// If the script should actually take the user to the preferred page you should replace the above line
// with a line like this:      {window.location="http://"+Preference}
else {

//alert('Hi - I do not know which size you prefer.');

}

}




function popUp(url) { 

if((!OpenWindow) || (OpenWindow.closed == true)) {

var OpenWindow=window.open(url, "newwin", 'status=yes,toolbar=yes,resizable=yes,location=yes,width=800,height=460,screenX=80,left=80,screenY=80,top=80'); 

OpenWindow.focus();

}

else {

OpenWindow.location.href = url;
OpenWindow.focus();

}
} 


function dateToday() {
	var dayOfWeek = new Date();
	var month = dayOfWeek.getMonth();
  	var day = dayOfWeek.getDay();
   	var year = dayOfWeek.getFullYear();
	var date = dayOfWeek.getDate();
	weekDay = new Array(7);
	weekDay[0] = "Sunday";
	weekDay[1] = "Monday";
	weekDay[2] = "Tuesday";
	weekDay[3] = "Wednesday";
	weekDay[4] = "Thursday";
	weekDay[5] = "Friday";
	weekDay[6] = "Saturday";
	dayToday = weekDay[day];
	monthArray = new Array(12);
	monthArray[0] = "January";
	monthArray[1] = "February";
	monthArray[2] = "March";
	monthArray[3] = "April";
	monthArray[4] = "May";
	monthArray[5] = "June";
	monthArray[6] = "July";
	monthArray[7] = "August";
	monthArray[8] = "September";
	monthArray[9] = "October";
	monthArray[10] = "November";
	monthArray[11] = "December";
	curMonth = monthArray[month];	
	//return dayToday + " " + curMonth + " " + date + ", " + year;
	return curMonth + " " + date + ", " + year;
  	}
var curDateToday = dateToday();  

var timerID = null
var timerRunning = false

function stopclock(){
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function startclock(){

stopclock()
showtime()
}
function showtime(){
var now = new Date()
var hours = now.getHours()
var minutes = now.getMinutes()
var seconds = now.getSeconds()
var timeValue = "" + ((hours > 12) ? hours - 12 : hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."

document.getElementById("face").value = timeValue;
timerID = setTimeout("showtime()",1000)
timerRunning = true
}

function showPanel2(PanelName,ImageName,xoffset,yoffset) {
  var menuPosition = imgXY(ImageName);                    		  /* detect the coordinates of the specified image */
  showPanel(PanelName, menuPosition.x+xoffset, menuPosition.y+yoffset);   /* display the menu x-offset and y-offset from upper left corner of image */
}

function imgXY(imgID) {                                   		  /* This function returns the upperleft x,y coordinates of the specified image */
  var XY = new Object();
  var imgObj = document.images[imgID];
  if (document.layers) {
	XY.x = eval(imgObj).x;
	XY.y = eval(imgObj).y;
  } else {
	var x,y, tempEl;
	x = eval(imgObj).offsetLeft;
	y = eval(imgObj).offsetTop;
	tempEl = eval(imgObj).offsetParent;
  	while (tempEl != null) {
  		x += tempEl.offsetLeft;
		y += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	XY.x = x;
	XY.y = y;
  }
  return XY;
}


function gj(ImageName,xoffset,yoffset) {
  var menuPosition = imgXY(ImageName);                    		  			/* detect the coordinates of the specified image */
  	//alert(menuPosition.x+xoffset);   					
	//alert(menuPosition.y+yoffset);
	whereX = menuPosition.x+xoffset
	whereY = menuPosition.y+yoffset
	//alert(whereX);   					
	//alert(whereY);
}


