function printit() {
	if (window.print) {
		window.print();
	} else {
    	var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2); //Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
	}
}

function selfStatus(message) {
	self.status=message
}

function checkHide() {
	if (mouseState) window.myHide()
}

function handleResize() {
        location.reload()
        return false
}

function method_popup(url,width,height) {
	// default size (method comparison images)
	if (!width) width=420
	if (!height) height=315
	// add factor for edges
	width += 30
	height += 30
	
	/*
	var extra = 'scrollbars=no, toolbar=no, location=no, menubar=no, status=no, resizable=no, directories=no'
	spawnWindow(420,315,url,'methodWindow',150,150,extra)
	*/
	var extra = 'scrollbars=no, toolbar=no, location=no, menubar=no, status=no, resizable=no, directories=no'
	spawnWindow(width,height,url,'methodWindow',150,150,extra)
}

function print_popup(url) {
	var extra = 'scrollbars=yes, toolbar=no, location=no, menubar=no, status=no, resizable=yes, directories=no'
	spawnWindow(700,450,url,'printWindow',150,150,extra)
}

function website_popup(url) {
	var extra = 'scrollbars=yes, toolbar=yes, location=yes, menubar=yes, status=yes, resizable=yes, directories=yes'
	spawnWindow(700,450,url,'websiteWindow',150,150,extra)
}

function launch(url) {
	if(url && url.length) {
		if (parent.sub_body) parent.sub_body.location.href = url
		else location.href = url
	}
	else {
		window.alert('ERROR - URL empty - launch()')
	}
}

function launchSelect(object) {
	url = object.options[object.selectedIndex].value
	if(url && url.length) {
		if (parent.sub_body) parent.sub_body.location.href = url
		else location.href = url
	}
	else {
		//window.alert('ERROR - URL empty - launch()')
		object.selectedIndex = 0
	}
}

function spawnWindow(width,height,url,name,xPos,yPos,extra) {
	extra = 'scrollbars=yes, toolbar=yes, location=yes, menubar=yes, status=yes, resizable=yes'
	// check for url
	if(url && url.length) {
		// init
		if (!width) width = 600
		if (!height) height = 400
		// build params
		var layout = "height=" + height + ",width=" + width
		if (extra) { layout += "," + extra }
		var newWindow = window.open(url, name, layout)
		//newWindow.location.href = url
		//if (!newWindow.opener) newWindow.opener = self
		newWindow.focus()
		newWindow.moveTo(xPos,yPos)
		return newWindow
	} else {
		window.alert('No url specified in javascript:spawnWindow() call')
	}
}

function loadWindow(destination)	{
	//var newFile = "new.html"
	var newFile = 'destination'
	opener.location = newFile
}

function closeWindow()	{
	window.close()
}

function spawnHelp(title,text) {
	//window.alert(title+'\n\n'+text)
	// init
	var width = 450
	var height = 250
	var url = '/help/popup.php?title='+encodeURI(title)+'&text='+encodeURI(text)+'&width='+width
	var name = 'helpWindow'
	var extra = 'scrollbars=yes, toolbar=no, location=no, menubar=no, status=no, resizable=no'
	// spawn
	spawnWindow(width,height,url,name,extra)
}

function showArch(){

	var strA = document.getElementById('arc_year').value;
	var strB = document.getElementById('arc_month').value;
	var extra = 'scrollbars=yes, toolbar=no, location=no, menubar=no, status=no, resizable=yes'
	var url = './archive/' + strA + '/' + strB;
	spawnWindow('600','400',url,'ArchiveMinutes',150,150,extra);
}

function set_pay_method(obj){
	var actual_pay_method=document.getElementById("actual_pay_method");
	//alert(actual_pay_method.value);
	actual_pay_method.value = obj.value;
	//alert(actual_pay_method.value);
}

function do_next_step(){
	var submit_obj=document.getElementById("actual_pay_method");
	var paypal_loc=document.getElementById("payment_details");
	//alert(submit_obj.value);
	if (submit_obj.value=="Online"){
		paypal_loc.action="https://www.paypal.com/cgi-bin/webscr";
		paypal_loc.submit();
		return true;
	}
	else
	{
		paypal_loc.action="/products/AI/license/step4c/index.php";
		paypal_loc.submit();
		return true;
	}
}

function deleterow(row_detail){
	var dr_url="/products/AI/license/step2/index.php";
	var o_form_rd = document.getElementById("delete_row")
	var o_form=document.getElementById("order_form")
	o_form_rd.value=row_detail;
	o_form.action = dr_url;
	o_form.submit();
	return true;
}

function NavLaunch(){
	var pc1=document.getElementById('contact_pc1').value;
	var pc2=document.getElementById('contact_pc2').value;
	var url="http://maps.google.co.uk/maps?f=d&hl=en&geocode=&saddr="+pc1+"+"+pc2+"&daddr=OX2+9AR&sll=54.188155,-4.042969&sspn=11.485608,38.496094&ie=UTF8&z=10";
	spawnWindow(750,600,url,"NavWindow")
	return true;
}