// JavaScript Document
var urlParams = {};
(function () {
    var e,
        a = /\+/g,  // Regex for replacing addition symbol with a space
        r = /([^&=]+)=?([^&]*)/g,
        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
        q = window.location.search.substring(1);

    while (e = r.exec(q))
       urlParams[d(e[1])] = d(e[2]);
})();

$(document).ready(function() {
	$('#navitem li').removeClass('selected-item');
	$('#'+navitem).addClass('selected-item');
	
	/*
	$(".contact-icons").click( function(event) {
		$("#contact-sales").toggleClass("expanded")									
	});
	*/
	
	$("#features-content").accordion({autoHeight:false, collapsible: true});
	$("#sysreq-content").accordion({autoHeight:false, collapsible: true});
	
	if(useGallery) {
		Galleria.loadTheme('/js/themes/classic/galleria.classic.min.js');
		$('#screenshot-gallery').galleria( { 
			height: 730,
			width: 800, 
			carouselFollow: false,
			showInfo: true,
			debug: false,
			imageCrop: false,
			_toggleInfo: false
			});
		$('.launch-gallery').colorbox({top:"50px",inline:true, href:"#screenshot-gallery"});
	}
	
	if(useCycle) {
		$('#home_banner').cycle({ 
			fx:    'scrollLeft', 
			speed:  800,
			timeout: 6500,
			pause: 1,
			pager: '#banner-nav',
			startingSlide: 0
		 });
		$('#user-logos').cycle({
			fx: 'fade', 
			speed:  1500,
			timeout: 1,
			random: 1
		});
	}
	
	$('.launch-demo').colorbox({iframe:true, innerWidth:800, innerHeight:600});
	
	$('#product-tabs li').click( function(event) {
		$('#product-tabs li').removeClass('selected');
		$(this).addClass('selected');
		thisTab = $(this).attr('id');
		$('#product-details .not-'+thisTab).removeClass('selected');
		$('#product-details .'+thisTab).addClass('selected');
	});
	
	$('#product-list-header').click( function(event) {
		$('.list-toggle').toggleClass('off');
		});
	
	if(!urlParams["select"]==""){
		$("."+urlParams["select"]).trigger('click');
	}
	
	if(urlParams["productlist"]){
		$('#product-list-header').trigger('click');
	}
 });

function checkForm()
	{	
		productString = "";
		$('input[name^="chkProduct"]').each(function(index) {
			if($(this).attr("checked")){
				productString = productString + $(this).attr("value") + ", ";
			}
		  });
		productString = productString.slice(0, -2);
		$('input[name="product"]').val(productString);
		return true;
	}





