///////////////////////////////
//jQuery Equal Height Columns//
///////////////////////////////
// make sure the $ is pointing to JQuery and not some other library
(function($){
// add a new method to JQuery
$.fn.equalHeight = function() {
// find the tallest height in the collection
// that was passed in (.col)
tallest = 0;
this.each(function(){thisHeight = $(this).height();if( thisHeight > tallest)tallest = thisHeight;});		
// set each items height to use the tallest value found
this.each(function(){$(this).height(tallest);});}})(jQuery);

//Activate Equal Height Columns
//$(function(){$('.col').equalHeight();});
//$(function(){$('.turnaround').equalHeight();});
//$(function(){$('.datafeed').equalHeight();});
$(function(){$('.tabtext').equalHeight();});

//////////////////
//jQuery Corners//
//////////////////
$(document).ready(function(){
   $(".cornertl").corner('round tl 15px');
   $(".cornerb").corner('round bottom 15px');
   $(".border").corner('round 10px');
   $(".datafeed").corner('round bottom 16px');
   $('.corner').corner("round top 30px");
   $('.topcorners').corner('round top 16px');
   $('.corners').corner("round 16px");
   $('.tab').corner("round top 10px");
});
//////////////////
//jQuery Nudging//
//////////////////
//$(document).ready(function() {
//	$('a.nudge').hover(function() { //mouse in
//		$(this).animate({ paddingLeft: '20px' }, 400);
//	}, function() { //mouse out
//		$(this).animate({ paddingLeft: 0 }, 400);
//	});
//});
////////////////////
//FAQ Menu Control//
////////////////////
//$(document).ready(function(){$('#menu > ul').dropmenu({effect:'fade',speed:'slow',timeout:250});});
//////////////////////////
//Contact Button Control//
//////////////////////////
function displayContact(action){
	switch(action){
		case 'show':
			document.getElementById('contact').innerHTML = '<a href="index.php">Contact Us</a>';
		break;
		case 'hide':
			document.getElementById('contact').innerHTML = '<a href="index.php">&#43;44 &#40;0&#41;1229 877779</a>';
		break;
		default:
			document.getElementById('contact').innerHTML = '<a href="index.php">&#43;44 &#40;0&#41;1229 877779</a>';
	}
}
function showForm(form){
	document.getElementById('add').style.display = 'none';
	document.getElementById('edit').style.display = 'none';
	document.getElementById('delete').style.display = 'none';
	document.getElementById('view').style.display = 'none';
	document.getElementById(form).style.display = 'block';
}
function getPage(page){
	document.getElementById(page).firstChild.style.color = "#f39";
	document.getElementById(page).childNodes[2].style.display = "block";
}
///////////////////////////////
//Load page in new tab script//
///////////////////////////////
var JSTarget = {
	init: function(att,val,warning) {
		if (document.getElementById && document.createElement && document.appendChild) {
			var strAtt = ((typeof att == 'undefined') || (att == null)) ? 'class' : att;
			var strVal = ((typeof val == 'undefined') || (val == null)) ? 'non-html' : val;
			var strWarning = ((typeof warning == 'undefined') || (warning == null)) ? ' (opens in a new window)' : warning;
			var oWarning;
			var arrLinks = document.getElementsByTagName('a');
			var oLink;
			var oRegExp = new RegExp("(^|\\s)" + strVal + "(\\s|$)");
			for (var i = 0; i < arrLinks.length; i++) {
				oLink = arrLinks[i];
				if ((strAtt == 'class') && (oRegExp.test(oLink.className)) || (oRegExp.test(oLink.getAttribute(strAtt)))) {
					oWarning = document.createElement("em");
					oWarning.appendChild(document.createTextNode(strWarning));
					oLink.appendChild(oWarning);
					oLink.onclick = JSTarget.openWin;
				}
			}
			oWarning = null;
		}
	},
	openWin: function(e) {
		var event = (!e) ? window.event : e;
		if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return true;
		else {
		    var oWin = window.open(this.getAttribute('href'), '_blank');
			if (oWin) {
				if (oWin.focus) oWin.focus();
				return false;
			}
			oWin = null;
			return true;
		}
	},
	/*
	addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	*/
	addEvent: function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn]( window.event );}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
JSTarget.addEvent(window, 'load', function(){JSTarget.init("rel","external","");});
$(document).ready(function() {$('.fade').cycle({fx:'fade',speed:2000,timeout:8000});});

