

function do_expand_contract() {
	if (document.getElementById) {
		policiesObj = document.getElementById("policies_data");
		policiesBtn = document.getElementById("policies_btn");
		divHeight = policiesObj.style.height;
	}
	else if (document.all) {
		policiesObj = document.all.policies_data;
		policiesBtn = document.all.policies_btn;
		divHeight = policiesObj.style.height;
	}
	if (divHeight == "500px") {
		policiesObj.style.height = "";
		policiesBtn.innerHTML = "-";
	} else {
		policiesObj.style.height = "500px";
		policiesBtn.innerHTML = "+";
	}
}

function do_print() {
	var  disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
		 disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
	var content_vlue = document.getElementById("policies_data").innerHTML;
	var docprint=window.open("","",disp_setting);
	docprint.document.open();
	docprint.document.write('<html><head><title>-</title>');
	docprint.document.write('</head><body onLoad="self.print()">');
	docprint.document.write(content_vlue);
	docprint.document.write('</body></html>');
	docprint.document.close();
	docprint.focus();
}

function switch_content(doc) {
	window.status="Updated";
	if (document.getElementById) {
		policiesObj = document.getElementById("policies_data");
		getElement = true;
		tosObj = document.getElementById("tos");
		aupObj = document.getElementById("aup");
		guaObj = document.getElementById("gua");
		priObj = document.getElementById("pri");
		canObj = document.getElementById("can");
	} else if (document.all) {
		policiesObj = document.all.policies_data;
		getElement = false;
		tosObj = document.all.tos;
		aupObj = document.all.aup;
		guaObj = document.all.gua;
		priObj = document.all.pri;
		canObj = document.all.can;
	}
	policiesObj.innerHTML = "<img src=\"images/loading.gif\" height=\"16\" width=\"16\" border=\"0\">";
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	switch (doc) {
		case "pri":
			url = "privacy.html";
			select_it('pri');
			break;
		case "can":
			url = "cancellation.html";
			select_it('can');
			break;
		case "aup":
			url = "aup.html";
			select_it('aup');
			break;
		case "gua":
			url = "gua.html";
			select_it('gua');
			break;
		default:
			url = "tos.inc.php";
			select_it('tos');
	}
	req.open("GET", url, true);
	req.onreadystatechange = processXMLResponse;
	req.send('');
}

function processXMLResponse() {
	if (document.getElementById) {
		policiesObj = document.getElementById("policies_data");
	} else if (document.all) {
		policiesObj = document.all.policies_data;
	}
	try {
		if (req.readyState == 4) {
			if (req.status == 200) {
				var HTMLcontent = req.responseText;
				HTMLcontent = HTMLcontent.replace("’","'"); // fix single quotes
				policiesObj.innerHTML = HTMLcontent;
			} else {
				alert("HTTP error: "+req.status+" "+req);
			}
		}
	} catch(e) {
		alert("Exception : " + e);
	}

}

function set_border(divName) {
	if (document.getElementById) {
		var divObj = document.getElementById(divName);
	} else if (document.all) {
		var divObj = document.all.divName;
	}
	divObj.style.borderTop="1px solid #ccc";
	divObj.style.borderLeft="1px solid #ccc";
	divObj.style.borderRight="1px solid #ccc";
}

function clear_border(divName) {
	if (document.getElementById) {
		var divObj = document.getElementById(divName);
	} else if (document.all) {
		var divObj = document.all.divName;
	}
	if (divObj.style.background.substr(0,4)=="#fff" || divObj.style.background.substr(0,3)=="rgb") {
		divObj.style.borderTop="1px solid #ccc";
		divObj.style.borderLeft="1px solid #ccc";
		divObj.style.borderRight="1px solid #ccc";
	} else {
		divObj.style.borderTop="1px solid #fff";
		divObj.style.borderLeft="1px solid #fff";
		divObj.style.borderRight="1px solid #fff";
	}
}

function select_it(divName) {
	clear_all();
	if (document.getElementById) {
		var divObj = document.getElementById(divName);
	} else if (document.all) {
		var divObj = document.all.divName;
	}
	divObj.style.background="#fff";
	set_border(divName);
}

function clear_all () {
	if (document.getElementById) {
		tosObj = document.getElementById("tos");
		aupObj = document.getElementById("aup");
		guaObj = document.getElementById("gua");
		priObj = document.getElementById("pri");
		canObj = document.getElementById("can");
	} else if (document.all) {
		tosObj = document.all.tos;
		aupObj = document.all.aup;
		guaObj = document.all.gua;
		priObj = document.all.pri;
		canObj = document.all.can;
	}
	tosObj.style.borderLeft="1px solid #fff";
	tosObj.style.borderTop="1px solid #fff";
	tosObj.style.borderRight="1px solid #fff";
	tosObj.style.background="#E8EBF0";
	aupObj.style.borderLeft="1px solid #fff";
	aupObj.style.borderTop="1px solid #fff";
	aupObj.style.borderRight="1px solid #fff";
	aupObj.style.background="#E8EBF0";
	guaObj.style.borderLeft="1px solid #fff";
	guaObj.style.borderTop="1px solid #fff";
	guaObj.style.borderRight="1px solid #fff";
	guaObj.style.background="#E8EBF0";
	priObj.style.borderLeft="1px solid #fff";
	priObj.style.borderTop="1px solid #fff";
	priObj.style.borderRight="1px solid #fff";
	priObj.style.background="#E8EBF0";
	canObj.style.borderLeft="1px solid #fff";
	canObj.style.borderTop="1px solid #fff";
	canObj.style.borderRight="1px solid #fff";
	canObj.style.background="#E8EBF0";
}
