function mycarousel_initCallback(carousel) {
jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
	
	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
};

function mycarousel_initCallback1(carousel) {
jQuery('#mycarousel-next1').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev1').bind('click', function() {
        carousel.prev();
        return false;
    });
};

$(document).ready(function() {

	//On Hover Over
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
		(function($) {
			//Function to calculate total width of all ul's
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() { //for each ul...
					rowWidth += $(this).width(); //Add each ul's width together
				});
			};
		})(jQuery); 
	
		if ( $(this).find(".row").length > 0 ) { //If row exists...
	
			var biggestRow = 0;	
	
			$(this).find(".row").each(function() {	//for each row...
				$(this).calcSubWidth(); //Call function to calculate width of all ul's
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
	
			$(this).find(".sub").css({'width' :biggestRow}); //Set width
			$(this).find(".row:last").css({'margin':'0'});  //Kill last row's margin
	
		} else { //If row does not exist...
	
			$(this).calcSubWidth();  //Call function to calculate width of all ul's
			$(this).find(".sub").css({'width' : rowWidth}); //Set Width
	
		}
	}
	//On Hover Out
	function megaHoverOut(){
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
		  $(this).hide();  //after fading, hide it
	  });
	}
	
	//Set custom configurations
	var config = {
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
		 interval: 100, // number = milliseconds for onMouseOver polling interval
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
		 timeout: 500, // number = milliseconds delay before onMouseOut
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)
	};
	
	$("ul#topnav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
	$("ul#topnav li").hoverIntent(config); //Trigger Hover intent with custom configurations
	
	$("ul#mainnav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
	$("ul#mainnav li").hoverIntent(config); //Trigger Hover intent with custom configurations
	
	jQuery("#mycarousel").jcarousel({
        scroll: 1,
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
	
	jQuery("#mycarousel1").jcarousel({
        scroll: 1,
        initCallback: mycarousel_initCallback1,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
	
	
	//Show Banner
	$(".main_image .desc").show(); //Show Banner
	$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$(".image_thumb ul li:first").addClass('active'); 
	$(".image_thumb ul li").click(function(){ 
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
		var imgDesc = "<p style='font-size:20px;'>" + $(this).find('.block .subheadinscroll').html() + "</p>"; 	//Get HTML of block
		imgDesc += "<p>" + $(this).find('.block p').html() + "</p>";
		//alert(imgDesc);
		var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block	
		
		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser				
			$(".main_image img").animate({ opacity: 0}, 250 );
			$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
				$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
				$(".main_image img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
			});
		}
		
		$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;
		
	}) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
			
	//Toggle Teaser
	$("a.collapse").click(function(){
		$(".main_image .block").slideToggle();
		$("a.collapse").toggleClass("show");
	});
	
	$('.tabs a').click(function(){
		switch_tabs($(this));
	});
 
	switch_tabs($('.defaulttab'));
	
	//jCarousel Plugin
	    $('#middlecarousel').jcarousel({
			vertical: true,
			scroll: 1,
			auto: 0,
			wrap: 'last',
			initCallback: mycarousel_initCallback
	   	});

	//Front page Carousel - Initial Setup
   	$('div#slideshow-carousel a img').css({'opacity': '0.5'});
   	$('div#slideshow-carousel a img:first').css({'opacity': '1.0'});
   	$('div#slideshow-carousel li a:first').append('<span class="arrow"></span>')

  
  	//Combine jCarousel with Image Display
    $('div#slideshow-carousel li a').hover(
       	function () {
        		
       		if (!$(this).has('span').length) {
        		$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
   	    		$(this).stop(true, true).children('img').css({'opacity': '1.0'});
       		}		
       	},
       	function () {
        		
       		$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
       		$('div#slideshow-carousel li a').each(function () {

       			if ($(this).has('span').length) $(this).children('img').css({'opacity': '1.0'});

       		});
        		
       	}
	).click(function () {

	      	$('span.arrow').remove();        
		$(this).append('<span class="arrow"></span>');
       	$('div#slideshow-main li').removeClass('active');        
       	$('div#slideshow-main li.' + $(this).attr('rel')).addClass('active');	
        	
       	return false;
	});


	
});


function fnc_clear()
{

	var frmObj1 = document.contactform;
	frmObj1.reset();
}

function fn_consSubmit()
{
	if(fnc_Submit() == true)	
	{
			document.contactform.submit();
	}
}

function fnc_DomainSubmit()
{
	var frmObj = document.frmDomain;
	
	if(frmObj.domainToCheck)
	{
		if(stripWhitespace(frmObj.domainToCheck.value) == false)
		{
			alert("Please enter a valid domain name.");	
			frmObj.domainToCheck.focus();
			return;
		}
	}
	
	frmObj.submit();
	
}

function fnc_Submit()
{

	var frmObj = document.contactform;
	if(frmObj.txtName)
	{
		if(frmObj.txtName.value == "")
		{
	
			alert("Please enter Name");
			frmObj.txtName.focus();
			return false;
		}
	
		if(frmObj.txtName.value != '')
		{
			if(stripWhitespace(frmObj.txtName.value) == false)
			{
	
			alert("Please enter valid Name");
			frmObj.txtName.focus();
			return false;
			}
		}
	

		if(frmObj.txtName.value != '')
		{
			if(isInteger(frmObj.txtName.value) == true)
			{
				alert("Please enter valid Name");
				frmObj.txtName.focus();
				return false;
			}
		}
	}
	
	if(frmObj.txtCompany)
	{
		
		if(frmObj.txtCompany.value== "")
		{
			alert("Please enter the Company Name");
			frmObj.txtCompany.focus();
			return false;
		}
		
		if(frmObj.txtCompany.value != '')
		{
			if(stripWhitespace(frmObj.txtCompany.value) == false)
			{
				alert("Please enter valid Company");
				frmObj.txtCompany.focus();
				return false;
			}
		}
	}

	if(frmObj.txtPhone)
	{
		if(stripWhitespace(frmObj.txtPhone.value) == false)
		{
			alert("Please enter valid Phone No.");
			frmObj.txtPhone.focus();
			return false;
		}
	
	
	
		if(frmObj.txtPhone.value != '')
		{
			if(CheckSSN(frmObj.txtPhone.value) == true)
			{
				alert("Please enter valid Phone No.");
				frmObj.txtPhone.focus();
				return false;
			}
		}
	}


	if(frmObj.txtEMail)
	{
		if(frmObj.txtEMail.value == "")
		{
			alert("Please enter Email Address");
			frmObj.txtEMail.focus();
			return false;
		}
		else
		{
			if(!isEmail(frmObj.txtEMail.value)){
				alert("Please input valid Email Address")
				frmObj.txtEMail.focus();
				return false;
			}
		}
	}

	if(frmObj.txtCity)
	{
		if(frmObj.txtCity.value == "")
		{
			alert("Please enter City");
			frmObj.txtCity.focus();
			return false;
		}
	}
	
	if(frmObj.txtComments)
	{
		if(frmObj.txtComments.value != '')
		{
			if(stripWhitespace(frmObj.txtComments.value) == false)
			{
				alert("Please enter valid Comments");
				frmObj.txtComments.focus();
				return false;
			}
		}
	}


	if(frmObj.number)
	{
		if(frmObj.number.value== "")
		{
			alert("Please enter the code");
			frmObj.number.focus();
			return false;
		}
	}


	
	
	


	frmObj.hdnFlag.value = '1';
	return true	;
	//frmObj.submit();

}



function checkemail()
{
	var str=document.contactform.txtEMail.value;
	var filter=/^.+@.+\..{2,3}$/ ;

	if (filter.test(str))
		return true;
	else {
		return false;
	}

}

<!-- Copyright 2006,2007 Bontrager Connection, LLC
  
// http://bontragerconnection.com/ and http://willmaster.com/

// Version: July 28, 2007

var cX = 0; var cY = 0; var rX = 0; var rY = 0;

function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}

function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}

if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }

else { document.onmousemove = UpdateCursorPosition; }

function AssignPosition(d) {

if(self.pageYOffset) {

rX = self.pageXOffset;

rY = self.pageYOffset;

}

else if(document.documentElement && document.documentElement.scrollTop) {

rX = document.documentElement.scrollLeft;

rY = document.documentElement.scrollTop;

}

else if(document.body) {

rX = document.body.scrollLeft;

rY = document.body.scrollTop;

}

if(document.all) {
cX += rX;

cY += rY;

}

d.style.left = (cX+10) + "px";

d.style.top = (cY+10) + "px";

}

function HideContent(d) {

if(d.length < 1) { return; }

document.getElementById(d).style.display = "none";

}

function ShowContent(d) {

if(d.length < 1) { return; }

var dd = document.getElementById(d);

AssignPosition(dd);

dd.style.display = "block";

}

function ReverseContentDisplay(d) {

if(d.length < 1) { return; }

var dd = document.getElementById(d);

AssignPosition(dd);

if(dd.style.display == "none") { dd.style.display = "block"; }

else { dd.style.display = "none"; }

}

 
function switch_tabs(obj)
{
	$('.tab-content').hide();
	$('.tabs a').removeClass("selected");
	var id = obj.attr("rel");
 
	$('#'+id).show();
	obj.addClass("selected");
}

//Carousel Tweaking

function mycarousel_initCallback(carousel) {
	
	
}

