// JQuery Scripts
$(document).ready(function(){
	
	$("ul.sf-menu").supersubs({ 
		minWidth:    14,   // minimum width of sub-menus in em units 
		maxWidth:    17,   // maximum width of sub-menus in em units 
		extraWidth:  3     // extra width can ensure lines don't sometimes turn over 
						   // due to slight rounding differences and font-family 
	}).superfish({		
		animation:   { height: 'show' }  // fade-in and slide-down animation
	});  // call supersubs first, then superfish, so that subs are 
			 // not display:none when measuring. Call before initialising 
			 // containing tabs for same reason. 

	/*
	
	/**
	* Adds the rounded corners to the bottom of the drop down menus, it also adds spacing
	*/
    $('ul.sf-menu li ul li.first').before('<li class="menu-spacing-first"></li>');
    $('ul.sf-menu li ul li.last').after('<li class="menu-spacing-last"></li>');
	/**
	 * Image Rollover Functionality
	 */
	$(".rollover").mouseover(function(){
		imgsrc = $(this).attr("src");
		matches = imgsrc.match(/-ro/);
		// don't do the rollover if state is already ON
		if (!matches) {
			
			if(imgsrc.indexOf('.gif') > -1) {
				imgsrcON = imgsrc.replace(/.gif$/ig,"-ro.gif"); // strip off extension - Gif
			} else if(imgsrc.indexOf('.jpg') > -1) {
				imgsrcON = imgsrc.replace(/.jpg$/ig,"-ro.jpg"); // strip off extension - Jpg		
			}
			
			$(this).attr("src", imgsrcON);
		}
	});
	
	$(".rollover").mouseout(function() {
		$(this).attr("src", imgsrc);
	});

});


function addBookmark(title,url) { 
 if (window.sidebar) { 
 	window.sidebar.addPanel(title, url,""); 
 } else if( document.all ) { 
 	window.external.AddFavorite(url, title); 
 } else if( window.opera && window.print ) { 
 	return true; 
	}
}

function ValidateForm(theForm) {
if(theForm.clientcode.value == '') {
	alert('Please fill in the "Proposal Code" field.');
	theForm.clientcode.focus();
	return false;
	}
return true;
}

// Date and Time functionality

var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym

var cdate=""+montharray[month]+" "+daym+", "+year+"";
if (document.all)
document.all.date.innerHTML=cdate;
else if (document.getElementById)
document.getElementById("date").innerHTML=cdate;
else
document.write(cdate);
}
if (!document.all&&!document.getElementById)
getthedate()
function displayDate(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000);
}



