
///////////////// jQUERY /////////////////////////////////
$(document).ready(function(){
    $(function() {
        $('#ulMain a').cluetip({
            splitTitle: '|', // use the invoking element's title attribute to populate the clueTip and split the contents into separate divs where there is a "|"
            showTitle: false, // hide the clueTip's heading
            fx: {
                open: 'slideDown', // can be 'show' or 'slideDown' or 'fadeIn'
                openSpeed:  '5'
            }
	});
    });
});



///////////////// GENERAL JS /////////////////////////////
function saveScrollCoordinates() {
	var hiddenY = document.getElementById('scrollY');
	var top = document.body.scrollTop;

	if (top == 0) {
		if (window.pageYOffset) {
			top = window.pageYOffset;
		}
		else {
			top = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
		}
	}

	hiddenY.value = top;
}

function scrollToCoordinates() {
	var y = document.getElementById('scrollY').value;
	window.scrollTo(0, y);
}

function setFocus(elementID) {
    if (elementID != "") {
        if (document.getElementById(elementID)) {
            document.getElementById(elementID).focus();
        }
    }
}

function confirmSubmit(type) {
    var agree = confirm("Are you sure you wish to " + type + "?");
    if (agree) {
            return true;
    }
    else {
            return false;
    }
}

function getYear() {
    var d =new Date();
    return d.getFullYear();
}

//////////// AJAX RESPONSE - LEGACY ////////////////////////////////
function handleAjaxResponse(response, responseID) {
    var element = document.getElementById(responseID);
    var text = "";

    switch (responseID) {
        case "txtHash":
            text = loadHashResponse(response);
            break;
        default:
            text = response;
    }
    element.innerHTML = text;
}

//////////// MAIN PAGE SCRIPTS //////////////////////////////////////
//JScript

//**********************************
//Get times for different time zones
//**********************************

//load day and month arrays
dayName = new Array ("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
monName = new Array ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
now = new Date();


//adjust for daylight saving time
function showDST(time)
{
    var gmt = new Date;
    var lsm = new Date;
    var lso = new Date;

    lsm.setMonth(2); // March
    lsm.setDate(1); // March 1
    var day = lsm.getDay(); // Day of week of March 1
    day = 7-day; // Get first Sunday after March 1
    lsm.setDate(1+day); // Set first Sunday after March 1
    lsm.setDate(day+8); // Set second Sunday after March 1


    lso.setMonth(10); // November
    lso.setDate(1); // November 1
    day = lso.getDay(); // day of week of November 1
    day = 7-day; // Get first Sunday after November 1
    lso.setDate(1+day); // Set first Sunday after November 1

    var dst = (gmt < lsm || gmt >= lso || (time == 0))? 0: 1;

    return dst
}


//adjust for daylight saving time
//function showDST(time) {
//    var gmt = new Date;
//    var lsm = new Date;
//    var lso = new Date;
//    lsm.setMonth(2); // March
//    lsm.setDate(31);
//    var day = lsm.getDay();// day of week of 31st
//    lsm.setDate(31-day); // last Sunday of month
//    lso.setMonth(9); // October
//    lso.setDate(31);
//    day = lso.getDay();// day of week of 31st
//    lso.setDate(31-day);// last Sunday of month
//    var dst = (gmt < lsm || gmt >= lso || (time == 0))? 0: 1;
//
//    return dst
//}

//format hours
function showTheHours(theHour) {
    if (theHour == 0) {
        return (12)
    }
    if (theHour < 13) {
        return (theHour)
    }
    return (theHour-12)
}

//fill in leading zero if value for minutes is less than 9
function showZeroFilled(inValue) {
    if (inValue > 9) {
        return ":" + inValue
    }
    return ":0" + inValue
}

//format am or pm
function showAmPm(thatTime) {
    if (thatTime < 12) {
        return (" AM ")
    }
    return (" PM ")
}

//use previous functions to return the current date and time
//arguments are UTC offset and value for dst (0 = no, 1 = yes)
function showTheTime(tzOffset,time) {
   thatTZ = new Date;
   dateStr = thatTZ.toGMTString();
   dateStr = dateStr.substring(0,dateStr.length-3);
   thatTZ.setTime(Date.parse(dateStr));
   thatTZ.setHours(thatTZ.getHours() + showDST(time) + tzOffset);

   //return dayName[thatTZ.getDay()] + " " + monName[thatTZ.getMonth()]+ " " + thatTZ.getDate() + "  " + showTheHours(thatTZ.getHours()) + showZeroFilled(thatTZ.getMinutes()) + showAmPm(thatTZ.getHours())
   return dayName[thatTZ.getDay()] + showAmPm(thatTZ.getHours())
}
//***********************************************************************************************************************


//Slide navigation menu down from top
function moveLayer(target, newTop)
{
    targetLayer = (document.getElementById) ? document.getElementById(target).style : eval("document." + target);
    targetLayer.top = newTop;
    if (newTop < 145)
    {
        setTimeout("moveLayer('" + target + "'," + (newTop + 1) + ")", 1);
    }
}

//Open Child Window with Menubar
function newWinMenu(a)
{
newWindow = window.open(a,'newWinMenu','width=840,height=580,status=yes,scrollbars=yes,location=yes,resizable=yes,menubar=yes,toolbar=yes,left=50,top=30');
newWindow.focus();
}

////Text for 'Marketing' Tool Tip
//{
//textMarketing = "Internationally recognized marketing expert ready to help you"
//}
//
////Text for 'Distribution' Tool Tip
//{
//textDist = "Find solutions to your distribution problems, international or domestic"
//}
//
////Text for 'Business Mgmt' Tool Tip
//{
//textBusMgmt = "Advisor to CEO's, Chairmen, Presidents, Boards and senior executives"
//}
//
////Text for 'Political Action' Tip
//{
//textAction = "Washington, D.C., Geneva, Brussels, Tokyo or New Delhi - we can help"
//}
//
////Text for 'Strategic Market Plans' Tool Tip
//{
//textPlans = "The key to success is a strategic market plan developed on matching products/services and markets"
//}




