jQuery(document).ready(function ($) {
	if (sSelectedButton == "contact")
	{
		$("#contact #theForm input[type='text']").css({display: 'block', marginBottom: '10px', width: '356px'});
		$("#contact label[for='contact']").css("margin-bottom","4px");
		$("#contact #theForm input[type='submit']").css({display: 'block', width: '227px', height: '58px', textIndent: '-9999px', border: 'none', margin: '42px 0 0 65px', cursor: 'pointer', background: 'transparent url(/wp-content/themes/elegal/images/content-design/btn-get-help.png) top left no-repeat'});
	}
	if (sSelectedButton == "blog")
	{
		$("#searchform #s").val("SEARCH");
		$('#searchform #s').click(function () {this.value = ''});
		$.browser.safari = ( $.browser.safari && /chrome/.test(navigator.userAgent.toLowerCase()) ) ? false : true;
		if ($.browser.safari) {
			$("#searchform #s").css("padding-top","3px");
		}
	}
	if (sSelectedButton == "home")
	{
		$("#homeContact label").css({display: 'block', textIndent: '-9999px'});
		$("#homeContact label[for='your-name']").css({width: '31px', height: '8px', marginBottom: '2px', background: 'transparent url(/wp-content/themes/elegal/images/home/label-name.gif) 2px 0 no-repeat'});
		$("#homeContact label[for='phone']").css({width: '31px', height: '10px', marginBottom: '1px', background: 'transparent url(/wp-content/themes/elegal/images/home/label-phone.gif) 3px 0 no-repeat'});
		$("#homeContact label[for='email']").css({width: '34px', height: '8px', marginBottom: '1px', background: 'transparent url(/wp-content/themes/elegal/images/home/label-email.gif) 3px 0 no-repeat'});
		$("#homeContact label[for='how-did-you']").css({width: '132px', height: '11px', marginBottom: '1px', background: 'transparent url(/wp-content/themes/elegal/images/home/label-how-hear.gif) 3px 0 no-repeat'});
		$("#homeContact input[type='text']").css({display: 'block', marginBottom: '10px', width: '242px', height: '21px', background: 'transparent url(/wp-content/themes/elegal/images/home/bg-input.png) top left no-repeat', border: 'none'});
		$("#homeContact input[type='submit']").css({display: 'block', width: '170px', height: '38px', textIndent: '-9999px', border: 'none', margin: '14px 0 0 -4px', cursor: 'pointer', background: 'transparent url(/wp-content/themes/elegal/images/home/btn-submit.png) top left no-repeat'});
		$("#homeListen").colorbox({width:"553px", height: "200px", inline:true, opacity:0.85, speed:350, scrolling:false, iframe: true});
		$("#homeRead").colorbox({width:"553px", height: "536px", inline:true, opacity:0.85, speed:350, scrolling:false});
		$("#homeWatch").colorbox({width:"678px", height: "430px", inline:true, opacity:0.85, speed:350, scrolling:false});
	}
	// select current page nav button
	imagePath = "/wp-content/themes/elegal/images/interface/l1-" + sSelectedButton + "-r.gif";
	$("#" + sSelectedButton + "-btn img").attr("src",imagePath);
});

var btnLevel1 = new Array();
btnLevel1 = ["home", "about", "your-rights", "how-we-help", "contact"];
for (var i = 0; i < btnLevel1.length; i++) {
	eval("A" + i + "on = new Image();"); eval("A" + i + "off = new Image();");
	eval("A" + i + "on.src = '/wp-content/themes/elegal/images/interface/l1-" + btnLevel1[i] + "-r.gif';");
	eval("A" + i + "off.src = '/wp-content/themes/elegal/images/interface/l1-" + btnLevel1[i] + "-0.gif';");
	if (sSelectedButton == btnLevel1[i]) {
		eval("A" + i + "off.src = '/wp-content/themes/elegal/images/interface/l1-" + btnLevel1[i] + "-r.gif';");
	}
}

// Image Swapping
function changeImages() 
{
  if (document.getElementById) {
    for (var i = 0; i < changeImages.arguments.length; i += 2) { 
  		document.getElementById(changeImages.arguments[i]).src = eval(changeImages.arguments[i + 1] + ".src"); 
	}
  }
}

var currentImage = 1;

function swapBack(theImage)
{
	var showThisImage;
	if (theImage == 1) {
		showThisImage = 4;
		currentImage = 4;
	} else {
		showThisImage = theImage - 1;
		currentImage = theImage - 1;
	}
	jQuery(document).ready(function($) {
		$(".galleryImage").css("display","none");
		$("#gallery" + showThisImage).css("display","block");
	});
}

function swapForward(theImage)
{
	var showThisImage;
	if (theImage == 4) {
		showThisImage = 1;
		currentImage = 1;
	} else {
		showThisImage = theImage + 1;
		currentImage = theImage + 1;
	}
	jQuery(document).ready(function($) {
		$(".galleryImage").css("display","none");
		$("#gallery" + showThisImage).css("display","block");
	});
}

var currentVideo = 1;

function swapVideoBack(theImage)
{
	var showThisImage;
	if (theImage == 1) {
		showThisImage = 3;
		currentVideo = 3;
	} else {
		showThisImage = theImage - 1;
		currentVideo = theImage - 1;
	}
	jQuery(document).ready(function($) {
		$(".homeVideos").css("display","none");
		$("#video" + showThisImage).css("display","block");
	});
}

function swapVideoForward(theImage)
{
	var showThisImage;
	if (theImage == 3) {
		showThisImage = 1;
		currentVideo = 1;
	} else {
		showThisImage = theImage + 1;
		currentVideo = theImage + 1;
	}
	jQuery(document).ready(function($) {
		$(".homeVideos").css("display","none");
		$("#video" + showThisImage).css("display","block");
	});
}
