// stores the reference to the XMLHttpRequest object
var xmlHttp = createXmlHttpRequestObject();
// retrieves the XMLHttpRequest object


function createXmlHttpRequestObject(){
	// will store the reference to the XMLHttpRequest object
	var xmlHttp;
	// if running Internet Explorer
	if(window.ActiveXObject){
		try {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e) {
			xmlHttp = false;
		}
	
	// if running Mozilla or other browsers
	} else {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
		}
	}
	// return the created object or display an error message



	if (!xmlHttp){
		alert("Error creating the XMLHttpRequest object.");
	} else {
		return xmlHttp;
	}
	// make asynchronous HTTP request using the XMLHttpRequest object
	
}

function ChangeSizes(){
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
		document.getElementById("sizebox").innerHTML = '<i>loading...</i>';
		var item_id = encodeURIComponent(document.getElementById("item_id").value);
		var x = document.getElementById("ColorA");
		var color_id = encodeURIComponent(x.options[x.selectedIndex].value);
		document.getElementById("Color").value = x.options[x.selectedIndex].text;
		// execute the quickstart.php page from the server
		//alert("record.php?name=" + name + "&focusvar=" + focusvar);
		//document.getElementById("divMessage").innerHTML = '<i>' + "Opening Connection..." + '</i>';
		xmlHttp.open("GET", "ajax_getsizes.php?colorid=" + color_id + "&itemid=" + item_id, true);
		// define the method to handle server responses
		xmlHttp.onreadystatechange = handleServerResponse;
		// make the server request
		xmlHttp.send(null);
		document.getElementById("submit").disabled = false;
	} else {
		// if the connection is busy, try again after one second
		setTimeout('ChangeSizes()', 1000);
	}
// executed automatically when a message is received from the server
}
function handleServerResponse(){
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4){
	// status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200){
			
			helloMessage = xmlHttp.responseText;
			document.getElementById("sizebox").innerHTML = '<i>' + helloMessage + '</i>';
		// a HTTP status different than 200 signals an error
		} else {
			alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
	}
}



function StoreGraphic(pagepop){
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
		//document.getElementById(filldiv).innerHTML = '<i>loading...</i>';
		xmlHttp.open("GET", pagepop, true);
		xmlHttp.onreadystatechange = handleStandard;
		xmlHttp.send(null);
		if(pagepop == 'pop_slideshow.php'){
			auto();
		}
	} else {
		setTimeout('StoreGraphic(pagepop)', 1000);
	}
}
function handleStandard(filldiv){
	if (xmlHttp.readyState == 4){
		if (xmlHttp.status == 200){
			helloMessage = xmlHttp.responseText;
			document.getElementById('store_large').innerHTML = helloMessage;
			document.getElementById('store_large').style.visibility = 'visible';
		} else {
			alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
	}
}

function setflashtotext(){
	document.getElementById('flashcontent').innerHTML = 'Bodylove is more than a brand of clothing. Bodylove is a new way of thinking. Through beautifully crafted Bodylove t-shirts, you can find your inner and outer beauty.  Each t-shirt infuses healing and empowering mantras to nurture the heart and soul of every body.<br><br>To be free. To live fully. To love ourselves and our bodies. To know our passions. To Bodylove.';
	document.getElementById('footerflash').innerHTML = '<p class="text_01">Divine Sizing: Scrumptious | Marvelous | Luscious | Extra Luscious</p>';
}
function setflashtoflash(){
	var so = new SWFObject("media/swf/bodylove2.swf", "mymovie", "459", "393", "8", "#336699");
   so.write("flashcontent");
   var fo = new SWFObject("media/swf/scrollsize.swf", "mymovie", "700", "125", "8", "#ffffff");
   fo.write("footerflash");
}
function stopshow() {
	window.clearInterval(run);
}
function clearBLpopup(){
	document.getElementById('store_large').innerHTML = '';
	document.getElementById('store_large').style.visibility = 'hidden';
	auto();
}
function checkLists(t1, t2, t3){
	if(t1 > 0}{
	   count = 0
	   while(count <= t1){
		   if(document.
	   }
	}
}