var PixilatorHelpSystem = 0;
var HoverHelpIcon = 0;


function ToggleHelpSystem() {

	if (PixilatorHelpSystem == 0) {
	
		PixilatorHelpSystem = 1;
		
		document.getElementById('PixilatorHelpSystemIcon').setAttribute('class','HelpTriggerIcon_Active');
		document.getElementById('PixilatorHelpSystemIcon').setAttribute('className','HelpTriggerIcon_Active');
		document.getElementById('PixilatorHelpSystemIcon').style.left='12';
		document.getElementById('PixilatorHelpSystemIcon').style.top='4';

	} else {
	
		PixilatorHelpSystem = 0;
		document.getElementById('PixilatorHelpSystemIcon').setAttribute('class','HelpTriggerIcon');
		document.getElementById('PixilatorHelpSystemIcon').setAttribute('className','HelpTriggerIcon');
		document.getElementById('PixilatorHelpSystemIcon').style.left='15';
		document.getElementById('PixilatorHelpSystemIcon').style.top='7';
	}
}


function ToggleHoverHelpIconFlag() {

	if (HoverHelpIcon == 0) {
	
		HoverHelpIcon = 1;
	
	} else {
	
		HoverHelpIcon = 0;
		
	}
}

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/


var PH_offsetfrommouse=[15,15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var PH_displayduration=0; //duration in seconds image should remain visible. 0 for always.
var PH_currentimageheight = 270;	// maximum image size.

if (document.getElementById || document.all){
	document.write('<div id="HelpTrailID" style="position:absolute; top:400; left:300; z-index:111999;">');
	document.write('</div>');
}

function PH_gettrailobj(){
if (document.getElementById)
return document.getElementById("HelpTrailID").style
else if (document.all)
return document.all.HelpTrailID.style
}

function PH_gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("HelpTrailID")
else if (document.all)
return document.all.HelpTrailID
}


function PH_truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function PH_showtrailsmall(imagename, height) {

	if (height > 0){
		PH_currentimageheight = height;
	}

	document.onmousemove=PH_followmouse;
	newHTML = '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888;">';
	newHTML = newHTML + '<div align="center" style="padding: 2px 2px 2px 2px;"><img src="' + imagename + '" border="0"></div>';
	newHTML = newHTML + '</div>';

	PH_gettrailobjnostyle().innerHTML = newHTML;
	PH_gettrailobj().visibility="visible";
}


function PH_showtrail(Title,Description){
	
	if (PixilatorHelpSystem == 1 || HoverHelpIcon == 1) {
	
	document.onmousemove=PH_followmouse;

	
	newHTML = '<div class="Pixilator_HelpText_Window">';
	
	
	
	
	if (arguments.length > 1) { 
	
		newHTML = newHTML + '<div class="Pixilator_HelpTitle_426F87">' + Title + '</div>';
		newHTML = newHTML + '<div class="Pixilator_HelpText_426F87">' + Description + '</div>';
		
	}
	
	

	if (arguments.length > 1) { 
		newHTML = newHTML + '</div>';
	}

	PH_gettrailobjnostyle().innerHTML = newHTML;

	PH_gettrailobj().visibility="visible";
	
	} //if (PixilatorHelpSystem == 1 || HoverHelpIcon == 1) {
}


function PH_hidetrail(){
	PH_gettrailobj().visibility="hidden"
	//document.onmousemove=""
	PH_gettrailobj().left="-500px"

}

function PH_followmouse(e){


var TrailBox = PH_gettrailobjnostyle().innerHTML;


	var xcoord=PH_offsetfrommouse[0]
	var ycoord=PH_offsetfrommouse[1]

	var docwidth=document.all? PH_truebody().scrollLeft+PH_truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(PH_truebody().scrollHeight, PH_truebody().clientHeight) : Math.min(window.innerHeight)

	//if (document.all){
	//	PH_gettrailobjnostyle().innerHTML = 'A = ' + PH_truebody().scrollHeight + '<br>B = ' + PH_truebody().clientHeight;
	//} else {
	//	PH_gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br>D = ' + window.innerHeight;
	//}

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 380){
			xcoord = e.pageX - xcoord - 400; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (PH_currentimageheight + 410)){
			ycoord += e.pageY - Math.max(0,(110 + PH_currentimageheight + e.pageY - docheight - PH_truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 380){
			xcoord = event.clientX + PH_truebody().scrollLeft - xcoord - 400; // Move to the left side of the cursor
		} else {
			xcoord += PH_truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (PH_currentimageheight + 410)){
			ycoord += event.clientY + PH_truebody().scrollTop - Math.max(0,(110 + PH_currentimageheight + event.clientY - docheight));
		} else {
			ycoord += PH_truebody().scrollTop + event.clientY;
		}
	}

	var docwidth=document.all? PH_truebody().scrollLeft+PH_truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(PH_truebody().scrollHeight, PH_truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
		if(ycoord < 0) { ycoord = ycoord*-1; }
	
	
	PH_gettrailobj().left=xcoord+"px"

	PH_gettrailobj().top=ycoord+"px"

}


