// JavaScript Document


//THIS FUNCTION TOGGLES SHOW/HIDE ON A DIV
function toggleMe(x) {
	$(x).toggle("slow");
}

//THIS FUNCTION LOADS URL INTO A DIV
function loadMe(x,y) {
	$(y).empty().html('<img align="right" src="http://galesupport.com/picts/loading_cengage.gif" alt="loading" />');
	$(y).load(x);
}

// SIMPLE FUNCTION TO SEND TO NEW URL
function getLink(x) {
	location.href = x;	
}

// FOR PRODUCT DISPLAY
function getProducts(l,h,pw,key,filter,s) {
	//1 l=loc
	//2 h = HEADER
	//3 pw - use password in link
	//4 key - FOR GEOIP
	
	if (h) {
		h=h.replace(/ /g, "_");
	}
	
	url = "/sybase/gale_products.php?loc=" + l + "&h=" + h + "&pw=" + pw + "&key=" + key + "&filter=" + filter + "&sort=" + s;

	// <![CDATA[	
	$("#results").empty().html('<img align="right" src="http://galesupport.com/picts/loading_cengage.gif" alt="loading" />');
	$("#results").load(url);
}

// FOR PRODUCT DISPLAY
// TWO COLUMN LOGOS
function getLogos(l,h,pw,key,filter,s) {
	//1 l=loc
	//2 h = HEADER
	//3 pw - use password in link
	//4 key - FOR GEOIP
	
	if (h) {
		h=h.replace(/ /g, "_");
	}
	
	url = "/sybase/gale_logos.php?loc=" + l + "&h=" + h + "&pw=" + pw + "&key=" + key + "&filter=" + filter + "&sort=" + s;

	// <![CDATA[	
	$("#results").empty().html('<img align="right" src="http://galesupport.com/picts/loading_cengage.gif" alt="loading" />');
	$("#results").load(url);
}

// FOR EBOOK DISPLAY
function getBooks(l,s,p,h,pw,ascd,key) {
	//1 l=loc
	//2 s = subject
	//3 p = prodID (optional)
	//4 h = HEADER
	//5 pw - use password in link
	//6 ascd - use subject as ascd category
	//7 key - FOR GEOIP
	
	
	if (h) {
		h=h.replace(/ /g, "_");
	}
	
	url = "/sybase/gale_ebooks.php?loc=" + l + "&subject=" + s + "&prod=" + p + "&h=" + h + "&pw=" + pw + "&ascd=" + ascd + "&key=" + key;

	// <![CDATA[	
	$("#results").empty().html('<img align="right" src="http://galesupport.com/picts/loading_cengage.gif" alt="loading" />');
	$("#results").load(url);
}

// FOR VIRTUAL EBOOK DISPLAY
function getVirtual(l,s,p,h,pw,ascd,key) {
	//1 l=loc
	//2 s = subject
	//3 p = prodID (optional)
	//4 h = HEADER
	//5 pw - use password in link
	//6 ascd - use subject as ascd category
	//7 key - FOR GEOIP
	
	if (h) {
		h=h.replace(/ /g, "_");
	}
	if (ascd) {
		ascd=ascd.replace(/ /g, "_");
	} else {
		ascd = "";
	}
	
	url = "/sybase/gale_virtual.php?loc=" + l + "&subject=" + s + "&prod=" + p + "&h=" + h + "&pw=" + pw + "&ascd=" + ascd;
	//alert(url);
	if (key != '')  {
		url += '&key' + key; 
	}
	//alert(url);
	// <![CDATA[	
	$("#results").empty().html('<img align="right" src="http://galesupport.com/picts/loading_cengage.gif" alt="loading" />');
	$("#results").load(url);
}

// Google analytics traking code
var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-6554141-5']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();



