﻿$(document).ready(function() {
	$.externallinks();

	$.firstchildamend();
	$('input[title!=""]').hint();
	$('textarea[title!=""]').hint();
	$('#banners').jcarousel({
		scroll: 1
	});
	$(".banner li span").css("display", "block");

	$('input.cpicker').ColorPicker({
		onSubmit: function(hsb, hex, rgb, el) {
			$(el).val("#" + hex);
			$(el).ColorPickerHide();
		},
		onBeforeShow: function() {
			$(this).ColorPickerSetColor(this.value);
		}
	})
	.bind('keyup', function() {
		$(this).ColorPickerSetColor(this.value);
    });  	
});

$.firstchildamend = function() {
	$(".footnav li:first-child,.testimonials li:first-child,.tasks li:first-child,.copyright li:first-child")
	.css("border", "0")
	.css("padding", "0")
	.css("margin", "0")
}

$.externallinks = function() {
	$('a[href^="http://"],a[rel="external"]')
	.attr({
		target: "_blank",
		title: function(arr) {
			if ($(this).attr("title").length > 0) {
				$(this).attr("title", $(this).attr("title") + " (opens in a new window)");
			}
			else {
				$(this).attr("title", "opens in a new window");
			}
		}
	});
	$('a[href^="http://clients.phoros.byteart.com/"]')
	.attr({
		target: "_self",
		title: function(arr) {
			$(this).attr("title", $(this).attr("title").replace(/ (opens in a new window)/, ""));
			$(this).attr("title", $(this).attr("title").replace(/(opens in a new window)/, ""));
		}
	});
}



function closeipod() {
	$(document).ready(function() {
		$("#ctl00_ipodbx").css("display", "none");
	});
}

 

//function clearfield(fieldid) {
//    if (document.getElementById(fieldid).value == document.getElementById(fieldid).defaultValue) {
//        document.getElementById(fieldid).value = ""
//    }
//}

//function unclearfield(fieldid, email) {
//    if (email) {
//        if (document.getElementById(fieldid).value == "" || document.getElementById(fieldid).value == document.getElementById(fieldid).defaultValue) {
//            document.getElementById(fieldid).value = document.getElementById(fieldid).defaultValue
//        }
//        else {
//            emailCheck(document.getElementById(fieldid).value)
//        }
//    }
//    else {
//        if (document.getElementById(fieldid).value == "") {
//            document.getElementById(fieldid).value = document.getElementById(fieldid).defaultValue
//        }
//    }
//}