function newwindow(jlink) {
	window.open(jlink,'','width=375, height=425,left=100,top=100,screenX=100,screenY=100, resizable=no, scrollbars=no, toolbar=no, status=no, menubar=no, copyhistory=no');
}
function newwindowbig(jlink) {
	window.open(jlink,'','width=300, height=400,left=100,top=100,screenX=100,screenY=100, resizable=no, scrollbars=no, toolbar=no, status=no, menubar=no, copyhistory=no');
}
function newwindow_large(jlink) {
	window.open(jlink,'','width=780, height=625,left=50,top=50,screenX=50,screenY=50,toolbar=no,status=no,menubar=no,scrollbars=yes,copyhistory=no');
}

function submitCart(requestid) {
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (req != undefined) {
		req.onreadystatechange = function() { updateAction("cart"); };
	
		req.open('POST', 'xhr/xhr_update_requestid.php', true);
 		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

 		text = "requestid=" + requestid;
 		text += "&page=5";
		req.send(text);
	}
}

function updateAction(actionType) {
	if (req.readyState == 4) { // only if req is "loaded"
		if (req.status == 200) { // only if "OK"
			text = "itWorked";
		}
	}	
}

function showCPL(id) {
	if (document.getElementById('cpl_' + id).style.display == 'block') {
		document.getElementById('cpl_' + id).style.display='none';
		document.getElementById('cpl_' + id + '_link').innerHTML='[+] CPL No.';
	} else {
		document.getElementById('cpl_' + id).style.display='block';
		document.getElementById('cpl_' + id + '_link').innerHTML='[-] CPL No.';
	}
}

function showlist(id) {
	if (document.getElementById('list_' + id).style.display == 'block') {
		document.getElementById('list_' + id).style.display='none';
		document.getElementById('list_' + id + '_link').innerHTML='Expand List';
	} else {
		document.getElementById('list_' + id).style.display='block';
		document.getElementById('list_' + id + '_link').innerHTML='Collapse List';
	}
}

function editlist(id) {
	if (document.getElementById('edit_' + id).style.display == 'block') {
		document.getElementById('edit_' + id).style.display='none';
		document.getElementById('edit_' + id + '_link').innerHTML='Edit';
	} else {
		document.getElementById('edit_' + id).style.display='block';
		document.getElementById('edit_' + id + '_link').innerHTML='Edit';
	}
}

function viewsummary(id) {
	if (document.getElementById('summary_' + id).style.display == 'block') {
		document.getElementById('summary_' + id).style.display='none';
		document.getElementById('summary_' + id + '_link').innerHTML='&raquo; View All';
	} else {
		document.getElementById('summary_' + id).style.display='block';
		document.getElementById('summary_' + id + '_link').innerHTML='&raquo; Collapse View';
	}
}

function viewproductlist(id) {
	if (document.getElementById('productlist_' + id).style.display == 'block') {
		document.getElementById('productlist_' + id).style.display='none';
		document.getElementById('productlist_' + id + '_link').innerHTML='&raquo; View Additional Engine Kits';
	} else {
		document.getElementById('productlist_' + id).style.display='block';
		document.getElementById('productlist_' + id + '_link').innerHTML='&raquo; Collapse Additional Engine Kit';
	}
}
