
//var url_prefix = "file:///C:/Users/Chong/Desktop/Jupp/jupp";
var url_prefix = "http://www.jupp.com.ph";

if (document.location.toString().indexOf("www") < 0)
{
	url_prefix = "http://jupp.com.ph";
}

function getResponseText(url)
{
	if ('undefined' == typeof(url)) return false;
	var p,rnd;
	if (document.all)
	{
		// For IE, create an ActiveX Object instance 
		p = new ActiveXObject("Microsoft.XMLHTTP");
	} 
	else
	{
		// For mozilla, create an instance of XMLHttpRequest.
		p = new XMLHttpRequest();
	}

	// Prevent browsers from caching the included page
	// by appending a random  number
	//rnd = Math.random().toString().substring(2);
	//url = url.indexOf('?')>-1 ? url+'&rnd='+rnd : url+'?rnd='+rnd;
	
	// Open the url and write out the response
	p.open("GET",url,false);
	p.send(null);
		
	return(p.responseText);
}
function include(url)
{
	document.write(getResponseText(url));
}
function hide(elem)
{
	document.getElementById(elem).style.display = 'none'
}
function show(elem)
{
	document.getElementById(elem).style.display = '';
}
function clearForm(formName)
{
    var e = document.getElementById(formName).elements;
    for(var elem, i = 0; (elem = e[i]); i++)
        if(elem.type=='checkbox')
            elem.checked = false;
        else if(elem.type=='textarea')
            elem.value = "";
        else if(elem.type=='text')
            elem.value = "";
        else if(elem.type=='select-one')
        	elem.selectedIndex = 0;
}
function enableForm(formName)
{
    var e = document.getElementById(formName).elements;
    for(var elem, i = 0; (elem = e[i]); i++)
        elem.disabled = false;
}
/*
  utils.js

*/

function openModalDialog(aUrl, title, returnFunc) {
  return openDialog(aUrl, 825, 400, returnFunc);
}

var dialogWin = new Object();

function openDialog(url, width, height, returnFunc, args)
{
	dialogWin.MODAL_RESULT = false;
	dialogWin.owner = window;
	dialogWin.returnFunc = returnFunc;
	dialogWin.returnedValue = '';
	dialogWin.returnedArrValue = [];
	dialogWin.args = args;
	dialogWin.url = url;
	dialogWin.width = width;
	dialogWin.height = height;

	var d = new Date();	
	dialogWin.name = (d.getMonth()+1)+"_"+d.getDate()+"_"+d.getYear()+"__"+d.getHours()+"_"+d.getMinutes()+"_"+d.getSeconds();
	
	dialogWin.left = (screen.availWidth - dialogWin.width) / 2;
	dialogWin.top = (screen.availHeight - dialogWin.height) / 2;
	if (window.showModalDialog) 
	{
		var attr = "scroll:yes;help:no;status:no;dialogWidth:" + String(dialogWin.width) + "px;dialogHeight:" + String(dialogWin.height) + "px;";
		var res = window.showModalDialog(url, window , attr);
		window.focus();
		if (res == true)
			dialogWin.returnFunc(args);
	}
	else 
	{
		var attr = "left=" + dialogWin.left + ",top=" + dialogWin.top + ",toolbar=no,modal=yes,dependent=yes,alwaysRaised=yes,scrollbars=yes,resizable=no,width=" + dialogWin.width + ",height=" + dialogWin.height;
		window.focus();
		dialogWin.win = window.open(dialogWin.url, dialogWin.name, attr);
		_blockEventsMoz(window.top);
	}
}


function includeMenu()
{
	include(url_prefix + "/menu.html");
}

function includeHeader()
{
	include(url_prefix + "/header.html");
}

function includeFooter()
{
	include(url_prefix + "/footer.html");
}


