$(function() { 
	$('ul.sf-menu').superfish({ 
		delay:       800,								// one second delay on mouseout 
		animation:   {opacity:'show',height:'show'},	// fade-in and slide-down animation 
		speed:       'fast',							// faster animation speed 
		autoArrows:  false,								// disable generation of arrow mark-up 
		dropShadows: false								// disable drop shadows 
	});
	$(".lightbox").lightbox();	//Initialize lightbox
	
	//add images to h2.h2blue tags
	$(".h2blue").each(function(){
		$(this).html("<img src='/images/h2BracketLeft.gif' align='absmiddle' />" + $(this).html() + "<img src='/images/h2BracketRight.gif' align='absmiddle' />").css({'padding' : '0px', 'height' : '29px'});
	});
	
	//Add Validation to the email signup form
	$("#profileform").validationEngine('attach', {
											promptPosition:"bottomLeft",
											scroll: false
										});
	
	
});

/*Homepage Header Slideshow */

$('.hpslideshow').cycle({
	fx: 'fade',
	speed:    2000, 
    timeout:  5000
});

/*Homepage Portfolio Slider */

$('#hpdesignportfolio').cycle({
    fx:     'scrollHorz',
    timeout: 0,
    next:   '#next2',
    prev:   '#prev2'
});

$('#hpdesignguides').cycle({
    fx:     'scrollHorz',
    timeout: 0,
    next:   '#next3',
    prev:   '#prev3'
});


//validation for newlsetter
function verifyRequired() {
	if (document.icpsignup["fields_email"].value == "") {
		document.icpsignup["fields_email"].focus();
		alert("The Email field is required.");
		return false;
	}
return true;
}

/*
a function to remove "enter you email" text from a field and replace it if the user doesn't enter anything
f = the field to remove the text from
t = the default text displayed in the field
r = 1 to remove the text, 0 to replace it with the default value
*/
function formTextRemove(f,t,r)
{
	if (r == 1){
		if (f.value == t){
			f.value = '';}
	}
	else if (r == 0){
		if (f.value == ''){
			f.value = t;}
	}
}



function switchIcons(num)
{
	/*var currImage = document.getElementById(num).src;
	var arrImgName = currImage.split("/");
	var imgName = arrImgName[arrImgName.length - 1].replace("tabIcon_"+num+"_","").replace(".gif","");
	alert(imgName);*/
	var img1 = document.getElementById('one');
	var img2 = document.getElementById('two');
	var img3 = document.getElementById('three');
	switch(num)
	{
		case 'one':
			img1.src = '/images/tabIcon_1_ON.gif';
			img2.src = '/images/tabIcon_2_OFF.gif';
			img3.src = '/images/tabIcon_3_OFF.gif';
			break;
		case 'two':
			img1.src = '/images/tabIcon_1_OFF.gif';
			img2.src = '/images/tabIcon_2_ON.gif';
			img3.src = '/images/tabIcon_3_OFF.gif';
			break;
		case 'three':
			img1.src = '/images/tabIcon_1_OFF.gif';
			img2.src = '/images/tabIcon_2_OFF.gif';
			img3.src = '/images/tabIcon_3_ON.gif';
			break;
	}
}







// [START] js from informz
fullURL = document.URL;
sAlertStr = '';
nLoc = fullURL.indexOf('&');

if (nLoc == -1) {
	nLoc = fullURL.length;
}

if (fullURL.indexOf('zreq=') > 0){
	sRequired = fullURL.substring(fullURL.indexOf('zreq=')+5, nLoc);
	if (sRequired.length > 0){
		sRequired = ',' + sRequired.replace('%20',' ');
		sRequired = sRequired.replace(/,/g,'\n  - ');
		sAlertStr = 'The following item(s) are required: '+sRequired + '\n';
	}
}

if (fullURL.indexOf('zmsg=') > 0) {
	sMessage = fullURL.substring(fullURL.indexOf('zmsg=')+5, fullURL.length);
	if (sMessage.length > 0) {
		sMessage = sMessage.replace(/%20/g, ' ');
		sMessage = sMessage.replace(/%0A/g, '\n');
		sAlertStr = sAlertStr + sMessage;
	}
}

if (sAlertStr.length > 0) {
	alert(sAlertStr);
}
// [END] js from informz
