// JavaScript Document

function parseURL() {
        var urlParts = new Object();
        // extract the domain name
		urlParts['fullURL'] = document.URL;
        urlParts['domain'] = document.URL.substr(0, document.URL.indexOf('/',7));
        // extract the path and file name
        urlParts['pathFile'] = document.URL.substr(document.URL.indexOf('/',7));

        // Handle any '#' or '?' in the pathPlus. They have to be removed for the on-state detection to work.
        if (urlParts['pathFile'].indexOf('#') != -1) { // Strip off any anchor and store it in the object.
                var pathPlusSplit = urlParts['pathFile'].split('#');
                urlParts['pathFile'] = pathPlusSplit[0];
                urlParts['anchor'] = pathPlusSplit[1];
        } else if (urlParts['pathFile'].indexOf('?') != -1) { // Strip off any arguments and discard, argument parsing will be handled by the getArgs function
                var pathPlusSplit = urlParts['pathFile'].split('?');
                urlParts['pathFile'] = pathPlusSplit[0];
        }

        //alert(url);
        // Extract the first directory of the URL
        // This is used to activate the main button on states
        // Extract everthing up to but not including the 2nd '/'
		var pathParts = urlParts['pathFile'].split('/');
		urlParts['mainDir'] = pathParts[1];
		urlParts['pathParts'] = pathParts;
        return urlParts;
}

function printerFriendly() {
	var domain = document.URL.substr(0, document.URL.indexOf('/',7));
	genPopUp = window.open("","printer","toolbar=no,location=no,scrollbars=yes,directories=no,status=yes,menubar=yes,resizable=yes,width=760,height=600");
	genPopUp.location.href = "/print.php";
	if (genPopUp.opener == null) genPopUp.opener = window;
	genPopUp.opener.name = "opener";
}
