//var fixedtop= "10";
var fixedleft="-2";

var checkhref=0;
//SuperNote.prototype.display=function(noteID,show)
var supernote = new SuperNote('supernote', {});


// Available config options are:
//allowNesting: true/false    // Whether to allow triggers within triggers.
//cssProp: 'visibility'       // CSS property used to show/hide notes and values.
//cssVis: 'inherit'
//cssHid: 'hidden'
//IESelectBoxFix: true/false  // Enables the IFRAME select-box-covering fix.
//showDelay: 0                // Millisecond delays.
//hideDelay: 500
//animInSpeed: 0.1            // Animation speeds, from 0.0 to 1.0; 1.0 disables.
//animOutSpeed: 0.1

// You can pass several to your "new SuperNote()" command like so:
//{ name: value, name2: value2, name3: value3 }


// All the script from this point on is optional!

// Optional animation setup: passed element and 0.0-1.0 animation progress.
// You can have as many custom animations in a note object as you want.
function animFade(ref, counter)
{
 //counter = Math.min(counter, 0.9); // Uncomment to make notes translucent.
 var f = ref.filters, done = (counter == 1);
 if (f)
 {
  if (!done && ref.style.filter.indexOf("alpha") == -1)
   ref.style.filter += ' alpha(opacity=' + (counter * 100) + ')';
  else if (f.length && f.alpha) with (f.alpha)
  {
   if (done) enabled = false;
   else { opacity = (counter * 100); enabled=true }
  }
 }
 else ref.style.opacity = ref.style.MozOpacity = counter*0.999;
};
supernote.animations[supernote.animations.length] = animFade;


// Optional custom note "close" button handler extension used in this example.
// This picks up click on CLASS="note-close" elements within CLASS="snb-pinned"
// notes, and closes the note when they are clicked.
// It can be deleted if you're not using it.
addEvent(document, 'click', function(evt)
{
 var elm = evt.target || evt.srcElement, closeBtn, note;

 while (elm)
 {
  if ((/note-close/).test(elm.className)) closeBtn = elm;
  if ((/snb-pinned/).test(elm.className)) { note = elm; break }
  elm = elm.parentNode;
 }

 if (closeBtn && note)
 {
  var noteData = note.id.match(/([a-z_\-0-9]+)-note-([a-z_\-0-9]+)/i);
  for (var i = 0; i < SuperNote.instances.length; i++)
   if (SuperNote.instances[i].myName == noteData[1])
   {
    setTimeout('SuperNote.instances[' + i + '].setVis("' + noteData[2] +
     '", false, true)', 100);
	cancelEvent(evt);
   }
 }
});


// Extending the script: you can capture mouse events on note show and hide.
// To get a reference to a note, use 'this.notes[noteID]' within a function.
// It has properties like 'ref' (the note element), 'trigRef' (its trigger),
// 'click' (whether its shows on click or not), 'visible' and 'animating'.
addEvent(supernote, 'show', function(noteID)
{
 // Do cool stuff here!
});
addEvent(supernote, 'hide', function(noteID)
{
 // Do cool stuff here!
});

function getScrollXY() 
{
	if(checkhref==0)
	{
		var pagelinks=document.getElementsByTagName("A")
		var tmploc=location.href;
		var currentloc=(tmploc.substring(0,tmploc.lastIndexOf("/")+1));
		for (var i=0; i<pagelinks.length; i++)
		{
			var onmo=pagelinks[i].getAttribute("href");
			if(onmo==currentloc) pagelinks[i].href="javascript:;";
		}
		checkhref=1;
	}
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' )
	{
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	}
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
	{
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} 
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
	{
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	scrOfY=scrOfY-10;
	return scrOfY;
}
function setpopup(id,bodycolor,headercolor,desccolor,headertxt,desctxt,audioname,imagename)
{
	if(bodycolor=="") bodycolor="F8F7E3";
	if(headercolor=="") headercolor="3C3A38";
	if(desccolor=="") desccolor="3C3A38";
	tmp="<span id='supernote-note-demo"+id+"' class='snp-triggeroffset notedefault'>";
	tmp=tmp+"<table border=0 cellspacing=0 cellpadding=0 valign=top>";
	tmp=tmp+"<tr>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"'><img src='http://www.forumeducation.net/img/popupimg/topleft.gif' border=0></td>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"' background='http://www.forumeducation.net/img/popupimg/top.gif'></td>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"'><img src='http://www.forumeducation.net/img/popupimg/topright.gif' border=0></td>";
	tmp=tmp+"</tr>";
	tmp=tmp+"<tr>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"' background='http://www.forumeducation.net/img/popupimg/left.gif'></td>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"'>";
	tmp=tmp+"<h5 style='color:"+headercolor+";font-size:14px;'>"+headertxt+"</h5>";
	if(desctxt.indexOf("«")==-1)
		tmp=tmp+"<span class='desc' style='color:"+desccolor+";'>"+desctxt+"</span>";
	else
	{
		desctxtarr=desctxt.split("«");
		for(var j=0;j<desctxtarr.length;j++)
		{
			if(desctxtarr[j]!="")
			{
				descidarr=desctxtarr[j].split("»");
				tmp=tmp+"<h5 style='color:"+headercolor+";font-size:14px;'>"+descidarr[0]+"</h5>";
				tmp=tmp+"<span class='desc' style='color:"+desccolor+";'>"+descidarr[1]+"</span>";
			}
		}
	}
	if(audioname!="" && audioname!=undefined) tmp=tmp+"&nbsp;&nbsp;<img src='http://www.forumeducation.net/tools/QuizTest/img/sound.gif' border='0'>";
	if(imagename!="" && imagename!=undefined) tmp=tmp+"<br><img src='http://www.forumeducation.net/"+imagename+"' border='0'>";
	tmp=tmp+"</td>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"' background='http://www.forumeducation.net/img/popupimg/right.gif'></td>";
	tmp=tmp+"</tr>";
	tmp=tmp+"<tr>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"'><img src='http://www.forumeducation.net/img/popupimg/bottomleft.gif' border=0></td>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"' background='http://www.forumeducation.net/img/popupimg/bottom.gif'></td>";
	tmp=tmp+"<td valign=top bgcolor='"+bodycolor+"'><img src='http://www.forumeducation.net/img/popupimg/bottomright.gif' border=0></td>";
	tmp=tmp+"</tr>";
	tmp=tmp+"</table>";
	tmp=tmp+"</span>";
	return tmp;
}

function playaudio(str)
{
	tmp="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='0' height='0' id='miniplayer' align='middle'>";
	tmp=tmp+"<PARAM NAME=FlashVars VALUE='myAudio=http://www.forumeducation.net/media/"+str+"'>";
	tmp=tmp+"<param name='allowScriptAccess' value='sameDomain' />";
	tmp=tmp+"<param name='movie' value='http://www.forumeducation.net/flash/minimini1.swf' />";
	tmp=tmp+"<param name='quality' value='best' />";
	tmp=tmp+"<param name='bgcolor' value='#f5fbff' />";
	tmp=tmp+"<embed src='http://www.forumeducation.net/flash/minimini1.swf' FlashVars='myAudio=http://www.forumeducation.net/media/"+str+"' quality='best' bgcolor='#f5fbff' width='0' height='0' name='miniplayer' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
	document.getElementById('MEDIAPAGE').innerHTML="";
	document.getElementById('MEDIAPAGE').innerHTML=tmp;
}

function stopaudio(str)
{
	tmp="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='0' height='0' id='miniplayer' align='middle'>";
	tmp=tmp+"<PARAM NAME=FlashVars VALUE='myAudio=http://www.forumeducation.net/media/"+str+"'>";
	tmp=tmp+"<param name='allowScriptAccess' value='sameDomain' />";
	tmp=tmp+"<param name='movie' value='http://www.forumeducation.net/flash/minimini.swf' />";
	tmp=tmp+"<param name='quality' value='best' />";
	tmp=tmp+"<param name='bgcolor' value='#f5fbff' />";
	tmp=tmp+"<embed src='http://www.forumeducation.net/flash/minimini.swf' FlashVars='myAudio=http://www.forumeducation.net/media/"+str+"' quality='best' bgcolor='#f5fbff' width='0' height='0' name='miniplayer' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
	document.getElementById('MEDIAPAGE').innerHTML="";
	document.getElementById('MEDIAPAGE').innerHTML=tmp;
}
