/*
##################### Do Not Remove This Header #####################
#                                                                   #
# Title: content                                                    #
# Description: Functions for working with the site content.         #      
# Author: Jonathan Merriweather                                     #
# Company: Mertech Solutions                                        #
# Date Created: 7/18/2008, 2008                                     #
# License: Licensed for use with websites built                     #
#          by Mertech Solutions.                                    #
#                                                                   #
#####################################################################
*/
var content=function(){var indentSize=25;$(function(){$(".link").click(function(event){event.preventDefault();event.stopPropagation();top.parent.historyManager.navigate($(this).attr("href"));});var contactInputs=["name","phone","email","enquiry"];$.each(content.items,function(i,n){$(n.toString()).click(function(event){top.parent.historyManager.go(n.toString());});});var contactItems=[".contactNationalPromotions",".contactByFriday",".contactEventManagement",".contactAmc",".contactPolicy"];$.each(contactItems,function(i,n){var selector=".contactBar "+n.toString();$(selector+" a").hover(function(){var currentImage=$(selector+" img").attr("src").toString().replace(".gif","_Over.gif");$(selector+" img").attr("src",currentImage);},function(){var currentImage=$(selector+" img").attr("src").toString().replace("_Over.gif",".gif");$(selector+" img").attr("src",currentImage);}).click(function(event){event.preventDefault();event.stopPropagation();top.parent.historyManager.go($(this).attr("href"));});});$("#submitButton").hover(function(){var currentImage=$("#submitButton img").attr("src").toString().replace(".gif","_Over.gif");$("#submitButton img").attr("src",currentImage);},function(){var currentImage=$("#submitButton img").attr("src").toString().replace("_Over.gif",".gif");$("#submitButton img").attr("src",currentImage);}).click(function(event){var errorItems="";var errorCount=0;$.each(contactInputs,function(i,n){var selector=n.toString();var item=$("#"+selector);if(item.val()==""){item.addClass("textBoxError");errorItems+=selector+", ";errorCount++;}else{item.removeClass("textBoxError");}});if(errorCount==0){event.preventDefault();event.stopPropagation();$("#contactForm").submit();}else{if(errorCount==1){alert(errorItems.substring(0,errorItems.length-2)+" is a required field.");}else{alert(errorItems+"are required fields.");}}});$("#closeButton").hover(function(){var currentImage=$("#closeButton img").attr("src").toString().replace(".gif","_Over.gif");$("#closeButton img").attr("src",currentImage);},function(){var currentImage=$("#closeButton img").attr("src").toString().replace("_Over.gif",".gif");$("#closeButton img").attr("src",currentImage);}).click(function(event){event.preventDefault();event.stopPropagation();top.parent.historyManager.go($(this).attr("href"));});var theGroupItems=["#theGroupPromotionalMerchandise","#theGroupGraphicDesign","#theGroupEventRegistraions","#theGroupNonprofitConsultants"];$.each(theGroupItems,function(i,n){$(n+" a").hover(function(){var currentImage=$(n+" img").attr("src").toString().replace(".gif","_Over.gif");$(n+" img").attr("src",currentImage);},function(){var currentImage=$(n+" img").attr("src").toString().replace("_Over.gif",".gif");$(n+" img").attr("src",currentImage);}).click(function(event){event.preventDefault();event.stopPropagation();top.parent.historyManager.go($(this).attr("href"));});});var sections=["#nationalPromotions","#byFriday","#eventManagement","#amc"];var natPromoItems=["_item1","_item2","_item3","_item4"];$.each(sections,function(i,n){var section=n.toString();$.each(natPromoItems,function(i,n){var selector=section.toString()+n.toString();$(selector).hover(function(){$.each(natPromoItems,function(i2,n2){var selector2=section.toString()+n2.toString();$(selector2).removeClass("active");$(selector2+"_content").hide();});var currentImage=$(section+"Col2 img").attr("src").toString().replace(".gif","_Over.gif");$(section+"Col2 img").attr("src",currentImage);$(this).addClass("active");$(selector+"_content").show();},function(){var currentImage=$(section+"Col2 img").attr("src").toString().replace("_Over.gif",".gif");$(section+"Col2 img").attr("src",currentImage);});});$(section.toString()+"_contact").hover(function(){var currentImage=$(section.toString()+"_contact img").attr("src").toString().replace(".gif","_Over.gif");$(section.toString()+"_contact img").attr("src",currentImage);},function(){var currentImage=$(section.toString()+"_contact img").attr("src").toString().replace("_Over.gif",".gif");$(section.toString()+"_contact img").attr("src",currentImage);}).click(function(event){event.preventDefault();event.stopPropagation();top.parent.historyManager.go($(this).attr("href"));});});});return{items:["#home1","#home2","#theGroup","#image1","#contactUs","#nationalPromotions","#byFriday","#eventManagement","#amc","#image2","#contact","#image3","#endFill"],currentIndex:0,scrollBack:function(speed,callback){if(content.currentIndex>0&&content.currentIndex<=content.items.length){var newIndex=content.currentIndex-1;content.scrollTo(newIndex,speed,callback);content.currentIndex=newIndex;}},scrollForward:function(speed,callback){if(content.currentIndex>=0&&content.currentIndex<content.items.length){var newIndex=content.currentIndex+1;content.scrollTo(newIndex,speed,callback);content.currentIndex=newIndex;}},scrollTo:function(itemNumber,speed,callback){if(itemNumber>=content.items.length){return;}var item=content.items[itemNumber];if(item!=undefined){content.currentIndex=$.inArray(item,content.items);content.scroll(item,speed,callback);}else{alert("unable to find "+itemNumber);}},scroll:function(selector,speed,callback){var movableObject=$('html,body');var item=content.items[content.currentIndex];var currentItemOffset=$(item).offset();movableObject.stop();content.currentIndex=$.inArray(selector,content.items);var itemWidth=$(selector).offset();if(itemWidth<=indentSize){indent=0;}var speed=500;movableObject.animate({scrollLeft:itemWidth.left-indentSize},{duration:speed,queue:false,complete:callback});},showItem:function(selector,callback){$(selector).show(1000,callback);},hideItem:function(selector,callback){$(selector).hide(callback);}}}();