// JavaScript Document

function openWindow(theUrl,winName) {
	window.open(theUrl,winName,"toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600,top=0,left=0");
}

function account_options() {
	//if ("https:" == document.location.protocol) ? "https://www.insidetheschool.com" : "http://www.insidetheschool.com");
	ajaxpage(host+'/wp-content/themes/its-2/account-options.php','account-window-container');
	document.getElementById('account-window-container').style.display='block'
	/*
	 Effect.BlindDown('account-window-container', { duration: .7 });
	$('account-window-container').fade({ duration: .7, from: 0, to: 1 });
	*/
}

function close_account_options() {
	Effect.BlindUp('account-window-container', { duration: .7 });
	document.getElementById('account-window-container').style.display='none'
	//$('account-window-container').fade({ duration: .7, from: 1, to: 0 });
}

function shopping_cart() {
	ajaxpage('/wp-content/themes/its-2/cart-ajax.php','cart-window-container');
	Effect.BlindDown('cart-window-container', { duration: .7 });
	$('cart-window-container').fade({ duration: .7, from: 0, to: 1 });
}

function close_shopping_cart() {
	Effect.BlindUp('cart-window-container', { duration: .7 });
	$('cart-window-container').fade({ duration: .7, from: 1, to: 0 });
}

function its_init() {
}

function pausecomp(millis) {
	var date = new Date();
	var curDate = null;
	do { 
		curDate = new Date(); 
	} while (curDate-date < millis);
} 

// basic function to get the AJAX object and return it
function getXMLHttp() {
	var xmlHttp
	try {
		// ff, opera8, safari
		xmlHttp = new XMLHttpRequest();
	} catch(e) {
		// ie
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				alert("Your browser does not support AJAX!")
				return false;
			}
		}
	}
	return xmlHttp;
}

// function takes the address to load and the div id to load it into.
// this comes in handy for ajax calls all over the rest of the site as
// it's very easy to create new ajax content very easily.
function ajaxpage(page,div) {
	var xmlHttp = getXMLHttp();
	xmlHttp.onreadystatechange = function() {
		if(xmlHttp.readyState == 4) {
			document.getElementById(div).innerHTML = xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET", page, true); 
	xmlHttp.send(null);
}



