function setBackground(div, img){
	div = document.getElementById(div);
	div.style.backgroundImage = "url(/images/" + img + ")";
}

function mycarousel_initCallback(carousel)
{
    jQuery('.jcarousel-control img').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this)[0].id));
		for(i=1;i<=4;i++){
			jQuery('#'+i)[0].src = '/images/0'+i+'.gif';
		}
		jQuery(this)[0].src = '/images/0'+jQuery(this)[0].id+'-IN.gif';
		carousel.startAuto(0);
        return false;
    });

    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function demofocus(field) {
	if(field.value == field.defaultValue){
		field.value = '';
		field.className = 'indemobox';
	}
}

function demoblur(field) {
	if(field.value == ''){
		field.value = field.defaultValue;
		field.className = 'demobox';
	}
}

function checkdemodefaults(){
	demoname = document.getElementById('demoname');
	demoemail = document.getElementById('demoemail');
	demophone = document.getElementById('demophone');
	if(demoname.value == demoname.defaultValue)
		demoname.value = "";
	if(demoemail.value == demoemail.defaultValue)
		demoemail.value = "";
	if(demophone.value == demophone.defaultValue)
		demophone.value = "";
}

function filterCaseStudy(){
	var selector = document.getElementById('filterStudies');
	var children = document.getElementById('casestudycontainer').getElementsByTagName('div');
	for(i=0;i<children.length;i++)
	{
		if(selector[selector.selectedIndex].value != "" && children[i].className != "hr")
			children[i].style.display = 'none';
		else
			children[i].style.display = '';
	}
	if(selector[selector.selectedIndex].value.length == 0)
		return true;
		
	for(i=0;i<children.length;i++)
	{
		childClass = children[i].className;
		childClass = childClass.split(" ");
		if(childClass.length > 1)
		{
			childClass.shift();
			for(var io=0; io<childClass.length; io++){
				//alert(selector[selector.selectedIndex].value +"::"+ childClass[io]);
				if(selector[selector.selectedIndex].value == childClass[io]){
					children[i].style.display = '';
				}
			}
		}
	}
}

var xmlLoad = false;
$(document).ready(function(){
	$.jGFeed('http://info.insite-commerce.com/CMS/UI/Modules/BizBlogger/rss.aspx?tabid=109464&moduleid=129476&maxcount=3&u=38669&t=c4b67d23-d57d-4d98-852d-5b3a0dfc8a87',
			 function(feeds){
				 // Check for errors
				 if(!feeds){      // there was an error
				 return false;
				 }
				 // do whatever you want with feeds here
				 for(var i=0; i<feeds.entries.length; i++){
					 var entry = feeds.entries[i];
					 // Entry title
					 entry.title;
					$('<li></li>').html('<a href="'+entry.link+'" target="_blank">'+entry.title+'</a>').appendTo('#hubspotlist');
					 }
					 }, 3);
	});


function step(){
	stepFade = fade * 1000;
	$(".belt").fadeOut(stepFade,function(){ nextPanel() });
	$(".belt").fadeIn(stepFade);
	thisFade = delay + (stepFade * 2);
	setTimeout("step()", thisFade);
}

function nextPanel(){
	index++;

	if (index < panelCount)
		leftOffset = leftOffset - 60;
	else
	{
		leftOffset = 0;
		index = 0;
	}

	$(belt).css({ top: leftOffset + 'px' });
}

