// Java Script
var division = null;
var category = null;

function addEvent(elm, evType, fn, useCapture){
//x-browser event handling function written by Scott Andrew
	if(elm.addEventListener){
		elm.addEventListener(evType, fn, useCapture);
		return true;
	}else if(elm.attachEvent){
			var r = elm.attachEvent('on' + evType, fn);
			//EventCache.add(elm, evType, fn);
			return r;
	}else{
			elm['on' + evType] = fn;
	}
}

// CHANGING IMAGE
var globalPath;
function callme() {
	alert("Thanks for calling!");
}

function changeImage(id, path, path2) {
	
	globalPath = path;
	document.getElementById(id).innerHTML = "<div align='center'><a href='viewMediumSize.php?image=" + path2 +"'><img src='" + path +"' border='0' /></div></a>";
}

function changeMediumSizeImage(id, path, path2) {

	document.getElementById(id).innerHTML = "<div align='center'><img src='"
											 + path + "'"
											 + " border='0' style='cursor:hand; cursor:pointer;'"
											 + " onClick=showTip('"+path2+"')"
											 + " />"
											 + "</div>";

	document.getElementById('viewLargeText').innerHTML = "<div align='center'>"
														+ " <strong style='color:#FFFFFF; cursor:hand; cursor:pointer'"
														+ " onClick=showTip('" + path2 + "')>"
														+ " View Large Image"
														+ " </strong>"
														+ " </div>";

	document.getElementById('imageContainer').innerHTML = "<img src='" + path2 +" />" ;
}

function showTip(path) {
	//alert(path);
	var x,y;
	x=210;
	y=145;	
	Tip('<img src='+path+' width=600 />', TITLE, '------------------------- Core Design and Product Development -------------------------', TITLEALIGN, 'center', CLOSEBTN, true, CLOSEBTNCOLORS, ['' , '#999999' , '#333333' , '' ], FIX, [x,y], TITLEBGCOLOR, '#262626', BGCOLOR, '#262626', BORDERCOLOR, '#333333');
}

function openImage(path) {
	var index, newPath;	
	index = path.indexOf('(');
	newPath = path.substring(0,index+1);
	newPath += "XL).png";
	var left = (screen.width/2) - (800/2);
	var top = (screen.height/2) - (786/2);
	//var newWindow = window.open(newPath,"Image",'width=800, height=786, status, scrollbars, resizable, top='+top+',left='+left);
	var newWindow = window.open("","",'width=800, height=786, status, scrollbars, resizable, top='+top+',left='+left);
	newWindow.document.writeln("<body bgcolor='#333333' ondragstart='return false' onselectstart='return false' oncontextmenu='return false'>");
	newWindow.document.writeln("<img src='" + newPath + "'>");
	newWindow.document.writeln("<\/body>");
	newWindow.focus();
}