

  //THESE ARE FOR POP UPS



function pop_up_file(filename){

window.open(filename,'special1','top=20,screenx=20,left=20,screeny=20,width=400,height=350,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no');

}

function pop_up_file490(filename){

window.open(filename,'special1','top=20,screenx=20,left=20,screeny=20,width=500,height=350,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no');

}

function pop_up_file500(filename){

window.open(filename,'special1','top=20,screenx=20,left=20,screeny=20,width=500,height=400,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no');

}

function updateParent(newURL){

opener.document.location = newURL

}





function signup(){

window.open('/newsletter/signup.htm','signup','top=10,screenx=10,left=10,screeny=10,width=500,height=400,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no');

}

function tipstricks(){

window.open('/newsletter/tips_tricks.shtml','tipstricks','width=790,height=450,buttons=yes,scrollbars=yes,location=no,menubar=yes,resizable=yes,status=yes,directories=no,toolbar=yes');

}

function knowmore(){

window.open('/newsletter/knowmore.shtml','knowmore','width=790,height=450,buttons=yes,scrollbars=yes,location=no,menubar=yes,resizable=yes,status=yes,directories=no,toolbar=yes');

}

function ofthemonth(){

window.open('/newsletter/ofthemonth.shtml','ofthemonth','width=790,height=450,buttons=yes,scrollbars=yes,location=no,menubar=yes,resizable=yes,status=yes,directories=no,toolbar=yes');

}

function lookout(){

window.open('/newsletter/lookout.shtml','lookout','width=790,height=450,buttons=yes,scrollbars=yes,location=no,menubar=yes,resizable=yes,status=yes,directories=no,toolbar=yes');

}

function archive(){

window.open('/newsletter/archive.shtml','archive','width=790,height=350,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=yes,directories=no,toolbar=no');

}

function emailfriend(){

window.open('/email_friend.html?url='+location.href,'emailfriend','width=600,height=665,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no');

}

function emailnewsletter(){

window.open('/newsletter/email_friend_newsletter.htm','emailfriendnewsletter','width=300,height=350,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no');

}

function updateParent(newURL) {

	opener.document.location = newURL

}



function mediavideo(){

window.open('/under_construction.htm','mediavideo','width=552,height=411,buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no');

}

function mediaaudio(){

window.open('/under_construction.htm','mediaaudio','width=552,height=411,buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no');

}



function construction(){

window.open('/under_construction.htm','construction','top=10,screenx=10,left=10,screeny=10,width=350,height=200,buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no');

}







  //THIS IS THE PULL DOWN MENU CODE



function fwLoadMenus() {

  if (window.fw_menu_0) return;

  window.fw_menu_0 = new Menu("root",217,17,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#000000","#efecdd","#d8d1ab");

  fw_menu_0.addMenuItem("HKCG Learning Center","location='../resources/learning_center.shtml'");

  fw_menu_0.addMenuItem("HKCG Encyclopedia","location='../resources/encyclopedia.shtml'");

  fw_menu_0.addMenuItem("HKCG Malware/Virus Prevention Tips","location='../resources/malware_prevention.shtml'");

   fw_menu_0.hideOnMouseOut=true;

  window.fw_menu_1 = new Menu("root",217,17,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#000000","#efecdd","#d8d1ab");

  fw_menu_1.addMenuItem("Newsletter Signup","location='javascript:signup()'");

  fw_menu_1.addMenuItem("1. Tips &amp; Tricks","window.open('../newsletter/tips_tricks.shtml', '_blank');");

  fw_menu_1.addMenuItem("2. Know More","window.open('../newsletter/knowmore.shtml', '_blank');");

  fw_menu_1.addMenuItem("3. Hardware/Software of the Month","window.open('../newsletter/ofthemonth.shtml', '_blank');");

  fw_menu_1.addMenuItem("4. Keep A Lookout For","window.open('../newsletter/lookout.shtml', '_blank');");

  fw_menu_1.addMenuItem("HKCG Newsletter Archive","location='../newsletter/archive.shtml'");

   fw_menu_1.hideOnMouseOut=true;

  window.fw_menu_2 = new Menu("root",175,17,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#000000","#efecdd","#d8d1ab");

  fw_menu_2.addMenuItem("Mission Statement","location='../philosophies/mission_statement.shtml'");

  fw_menu_2.addMenuItem("What Makes Us Different...","location='../philosophies/whatmakesusdifferent.shtml'");

  fw_menu_2.addMenuItem("Raving Fans","location='../philosophies/raving_fans.shtml'");

  fw_menu_2.addMenuItem("Classmates","location='../philosophies/classmates.html'");

  fw_menu_2.addMenuItem("HKCG Friendships Program","location='../philosophies/friendships.html'");

  fw_menu_2.addMenuItem("Employment Opportunities","location='../philosophies/employment.shtml'");

   fw_menu_2.hideOnMouseOut=true;

  window.fw_menu_3 = new Menu("root",157,17,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#000000","#efecdd","#d8d1ab");

  fw_menu_3.addMenuItem("Individual/Family","location='../services/individual.shtml'");

  fw_menu_3.addMenuItem("Small/Medium Business","location='../services/medium.shtml'");

  fw_menu_3.addMenuItem("Corporate/Enterprise","location='../services/corporate.shtml'");

   fw_menu_3.hideOnMouseOut=true;



  writeMenus();


} // fwLoadMenus()









  //THIS IS THE BANNER AD CODE



function getCode()

{

  //set the width

  var theWidth = "177";

	

  //set the height

  var theHeight = "100";

  

  //set the path to the images

  var pathToImages = "/friendships_gif";

  

  //set the path to the flash files

  var pathToFlash = "/friendships_flash";

  

  // make the list of files and their links (Assuming Flash files have their link embedded in them, just enter an empty string for their values)

  // IMPORTANT: NO COMMA AFTER LAST ARRAY ITEM

  var listOfImages = new Array

  (

    new Array("koolmoves.swf", ""),

    new Array("realview.swf", ""),

    new Array("newsknowledge.swf", ""),

    new Array("toonboom.swf", ""),

    new Array("trekstorusa.swf", ""),

    new Array("webcontact.swf", ""),

    new Array("wildform.swf", ""),

    new Array("fineprint.swf", ""),

    new Array("xara.swf", ""),

    new Array("videowave.swf", ""),

    new Array("photosuite.swf", ""),

    new Array("flash_po.swf", ""),

    new Array("ecdc1.swf", ""),

    new Array("banner_hemera.swf", ""),

    new Array("annotis.gif", "http://www.annotis.com"),

    new Array("eholster.gif", "http://www.eholster.com"),

    new Array("quask.gif", "http://www.quask.com"),

    new Array("rtbwizards.gif", "http://www.rtbwizards.com"),

    new Array("sjdesign.gif", "http://www.sjdesign.com"),

    new Array("trellian.gif", "http://www.trellian.com/"),

    new Array("vcd.gif", "http://www.virtualcd-online.com"),

    new Array("ulead1.gif", "http://www.ulead.com"),

    new Array("ulead2.gif", "http://www.ulead.com"),

    new Array("ulead3.gif", "http://www.ulead.com")

  );



  //get the number of items in the list

  var numberOfImagesInList = listOfImages.length;

  

  //To generate a random number, get the current time and...

  var randomNumber = Math.floor(Math.random() * numberOfImagesInList);

  

  //use the current time mod the number of items in the list

  var theWinnerIs = listOfImages[randomNumber];



  //if the winner ends with .swf (the last occurance of ".swf" is 4 less than the length of the string)

  if(theWinnerIs[0].length - theWinnerIs[0].lastIndexOf('.swf') == 4)

  {

    return getFlash(theWinnerIs, theHeight, theWidth, pathToFlash);

  }

  

  //if it doesn't end with .swf, assume it's a graphic

  return getImage(theWinnerIs, theHeight, theWidth, pathToImages);

  

}



function getFlash(theWinner, theHeight, theWidth, pathToFlash)

{

  var flashCode = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"" + theWidth + "\" height=\"" + theHeight + "\">";

  flashCode += "<param name=\"movie\" value=\"" + pathToFlash + "/" + theWinner[0] + "\">";

  flashCode += "<param name=\"quality\" value=\"high\">";

  flashCode += "<embed src=\"" + pathToFlash + "/" + theWinner[0] + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + theWidth + "\" height=\"" + theHeight + "\"></embed></object>";

  return flashCode;

}



function getImage(theWinner, theHeight, theWidth, pathToImages)

{

  var imageCode = "<a href=\"" + theWinner[1]+ "\"><img src=\"" + pathToImages + "/" + theWinner[0] + "\" border=\"0\" width=\"" + theWidth + "\" height=\"" + theHeight + "\"></a>";

  return imageCode;

}


  //GENERATE RANDOM NUMBER

var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");



var d = new Date(currenttime);
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
serverdate = new Date(utc + (3600000*-20));

function padlength(what){
var output=(what.toString().length==1)? "0"+what : what;
return output;
}

function displaydate(date){
	date.setSeconds(date.getSeconds()+1);
	var datestring=date.getFullYear()+", "+date.getMonth()+", "+date.getDate()+", "+date.getDay();
	return datestring;
}

function displaytime( ts ){
	ts.setSeconds(ts.getSeconds()+1);
	var timestring=padlength(ts.getHours())+":"+padlength(ts.getMinutes())+":"+padlength(ts.getSeconds());
	return timestring;
}

var localtime=displaytime(new Date());  
var localdate=displaydate(new Date());  
	
var hawaiitime=displaytime(serverdate);  
var hawaiidate=displaydate(serverdate);  
 

var soldDays = [
[2009, 10, 12, "Discoverer's Day"],
[2009, 11, 11, "VeteranŐs Day"],
[2009, 11, 26, "Thanksgiving"],
[2009, 11, 27, "Thanksgiving"],
[2009, 12, 14, "Annual Winter Break"],
[2009, 12, 15, "Annual Winter Break"],
[2009, 12, 16, "Annual Winter Break"],
[2009, 12, 17, "Annual Winter Break"],
[2009, 12, 18, "Annual Winter Break"],
[2009, 12, 19, "Annual Winter Break"],
[2009, 12, 20, "Annual Winter Break"],
[2009, 12, 21, "Annual Winter Break"],
[2009, 12, 22, "Annual Winter Break"],
[2009, 12, 23, "Annual Winter Break"],
[2009, 12, 24, "Annual Winter Break"],
[2009, 12, 25, "Annual Winter Break"],
[2009, 12, 26, "Annual Winter Break"],
[2009, 12, 27, "Annual Winter Break"],
[2009, 12, 28, "Annual Winter Break"],
[2009, 12, 29, "Annual Winter Break"],
[2009, 12, 30, "Annual Winter Break"],
[2009, 12, 31, "Annual Winter Break"],
[2010, 01, 01, "Annual Winter Break" ],
[2010, 01, 02, "Annual Winter Break" ],
[2010, 01, 03, "Annual Winter Break" ],
[2010, 01, 04, "Annual Winter Break" ],
[2010, 01, 05, "Annual Winter Break" ],
[2010, 01, 06, "Annual Winter Break" ],
[2010, 01, 07, "Annual Winter Break" ],
[2010, 01, 08, "Annual Winter Break" ],
[2010, 01, 18, "Martin Luther King, Jr. Day"],
[2010, 02, 15, "President\Ős day"],
[2010, 03, 02, "Annual Family Retreat"],
[2010, 03, 03, "Annual Family Retreat"],
[2010, 03, 04, "Annual Family Retreat"],
[2010, 03, 05, "Annual Family Retreat"],
[2010, 03, 06, "Annual Family Retreat"],
[2010, 03, 15, "Family and Friends Break"],
[2010, 03, 16, "Family and Friends Break"],
[2010, 03, 17, "Family and Friends Break"],
[2010, 03, 18, "Family and Friends Break"],
[2010, 03, 19, "Family and Friends Break"],
[2010, 04, 02, "Good Friday"],
[2010, 05, 31, "Memorial Day"],
[2010, 06, 11, "King Kamehameha Day"],
[2010, 07, 19, "Annual Summer Break"],
[2010, 07, 20, "Annual Summer Break"],
[2010, 07, 21, "Annual Summer Break"],
[2010, 07, 22, "Annual Summer Break"],
[2010, 07, 23, "Annual Summer Break"],
[2010, 08, 20, "Statehood Day"],
[2010, 09, 06, "Labor Day"],
[2010, 10, 11, "Discoverer\Ős Day"],
[2010, 11, 11, "Veteran\'s Day"],
[2010, 11, 25, "Thanksgiving"],
[2010, 11, 26, "Thanksgiving"],
[2010, 12, 20, "Annual Winter Break"],
[2010, 12, 21, "Annual Winter Break"],
[2010, 12, 22, "Annual Winter Break"],
[2010, 12, 23, "Annual Winter Break"],
[2010, 12, 24, "Annual Winter Break"],
[2010, 12, 25, "Annual Winter Break"],
[2010, 12, 26, "Annual Winter Break"],
[2010, 12, 27, "Annual Winter Break"],
[2010, 12, 28, "Annual Winter Break"],
[2010, 12, 29, "Annual Winter Break"],
[2010, 12, 30, "Annual Winter Break"],
[2010, 12, 31, "Annual Winter Break"],
[2011, 01, 01, "Annual Winter Break"],
[2011, 01, 02, "Annual Winter Break"],
[2011, 01, 03, "Annual Winter Break"],
[2011, 01, 04, "Annual Winter Break"],
[2011, 01, 05, "Annual Winter Break"],
[2011, 01, 06, "Annual Winter Break"],
[2011, 01, 07, "Annual Winter Break"]
				];

function closed() { 
for (i = 0; i < soldDays.length; i++) { 
		if (serverdate.getFullYear() == soldDays[i][0] && serverdate.getMonth() == soldDays[i][1] - 1 && serverdate.getDate() == soldDays[i][2]) { 
			$reason = 'Closed for '+ soldDays[i][3];
			return $reason; 
		}
		else if(serverdate.getDay() == 0 || serverdate.getDay() == 6){ //Sunday || Saturday
			return "Closed on Weekends"; 
		}
		else if(serverdate.getHours()<=8){
			return 'Currently Closed (Monday-Friday 9am-5pm HST)'; 
		} 
		else if(serverdate.getHours()>=16){
			return 'Currently Closed (Monday-Friday 9am-5pm HST)'; 
		} 
		
		else {
			return false; 
		}
	} 
} 		

//var notopen=closed();



function getRandom( max ) {

var max = Math.round((Math.random() * max + 0.5));
  
var tm=new Date(max*1000)
var hours=tm.getUTCHours();
var minutes=tm.getUTCMinutes();
var seconds=tm.getUTCSeconds(); 
var hs=' hour';
var ms=' minute';
var ss=' second';
if (hours==0) {
	hours='';
	hs='';
}
else if (hours!=1) {
	hs+='s';
}

if (minutes==0) {
	minutes='';
	ms='';
}
else if(minutes!=1){
	ms+='s';
}

if((minutes!=0 && hours!=0) || (seconds!=0 && hours!=0)){
	hs+=' ';
}

if(seconds==0){
	seconds='';
	ss='';
}
else if (seconds!=1) {
	ss+='s'
} 
if(minutes!=0 && seconds!=0){
	ms+=' ';
}

iRandom =  hours+hs+minutes+ms+seconds+ss

//	alert(iRandom);
if(closed()){
	return closed();
} else {
	return iRandom;
}


}


function getLabelForId(id) {
    var label, labels = document.getElementsByTagName('label');
    for (var i = 0; (label = labels[i]); i++) {
        if (label.htmlFor == id) {
            return label;
        }
    }
    return false;
}
