//note: this script should load in the head tag, since it contains global variables

//var baseDir = '../matrixap/';
var baseDir = '';

/*var showDirArticleID = 3;
var searchArticleID = 4;
var scheduleArticleID = 5;
var allLinesArticleID = 6;
var aofLinesArticleID = 7;*/
var showDirArticleID = 56;
var searchArticleID = 60;
var scheduleArticleID = 61;
var allLinesArticleID = 64;
var aofLinesArticleID = 65;

var alertDisplayed;

var lastShowDate = '2011-01-13';   //SET TO FINAL DAY OF SHOW

function clearSearch(locationString) {
	var s = locationString;

	s = s.replace(/&id=[^&]+/, '');
	s = s.replace(/&cid=[^&]+/, '');
	s = s.replace(/&eid=[^&]+/, '');
	s = s.replace(/&lid=[^&]+/, '');
	s = s.replace(/&exh=[^&]+/, '');
	s = s.replace(/&line=[^&]+/, '');
	s = s.replace(/&ad1=[^&]+/, '');
	s = s.replace(/&ad2=[^&]+/, '');
	s = s.replace(/&sort=[^&]+/, '');
	s = s.replace(/&print=[^&]+/, '');
	s = s.replace(/&preReg=[^&]+/, '');
	s = s.replace(/#x.*/, '');

	if (alertDisplayed && s.indexOf('alert') == -1) s = s + '&alert=1';
	
	return s;
}

function sel(exhibitorID, lineID) {
	var s = clearSearch(location.href);
	s += '&id=' + showDirArticleID.toString();
	s += '&eid=' + exhibitorID.toString();
	if (arguments.length > 1) s += '&lid=' + lineID.toString();
	s += '&ad1=' + ad1Index.toString();
	s += '&ad2=' + ad2Index.toString();
	//s += '#x';
	
	location = s;
}

function viewExhibitors(otherWindow) {
	var s;

	if (otherWindow) {
		s = clearSearch(opener.location.href);
		s += '&id=' + showDirArticleID.toString();
		opener.location = s;
		window.close();
	} else {
		s = clearSearch(location.href);
		s += '&id=' + showDirArticleID.toString();
		location = s;
	}
}

function viewSchedule(otherWindow) {
	var s;

	if (otherWindow) {
		s = clearSearch(opener.location.href);
		s += '&id=' + scheduleArticleID.toString();
		opener.location = s;
		window.close();
	} else {
		s = clearSearch(location.href);
		s += '&id=' + scheduleArticleID.toString();
		location = s;
	}
}

function viewLines(whichSet) {
	var s = clearSearch(location.href);
	if (whichSet == 1) s += '&id=' + allLinesArticleID.toString();			
	else s += '&id=' + aofLinesArticleID.toString();
	s += '&ad1=' + ad1Index.toString();
	s += '&ad2=' + ad2Index.toString();
	location = s;
}

function buttonMouseOver(theButton) {
	theButton.style.cursor = 'pointer';
}

function buttonMouseOut(theButton) {
	theButton.style.backgroundColor = '#627f00';
	theButton.style.cursor = 'auto';
}

function buttonMouseDown(theButton) {
	theButton.style.backgroundColor = '#89b300';
}

function buttonMouseUp(theButton) {
	theButton.style.backgroundColor = '#627f00';
}

