<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/********
 * Opens a new window
********/
var curPopupWindow = null;
function DemoWin() {
eval(DemoPath.substring(11)); 
}//end DemoWin


function openWindow(url, winName, width, height, center, winType) {

   var xposition = 50; // Postions the window vertically in px
   var yposition = 50; // Postions the window horizontally in px
   var location, menubar, resizable, scrollbars, status, titlebar;

   if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
       xposition = (screen.width - 800) / 2;
       yposition = (screen.height - 600) / 2;
   } 
   
   if (winType == "1") {           // winType 1 is for regular popup windows
      location=1;
      menubar=1;
      resizable=1;
      scrollbars=1;
      status=1;
      titlebar=1;
   } else if (winType == "2") {   // winType 2 is for Quick Tour like popups
      location=0;
      menubar=0;
      resizable=0;
      scrollbars=0;
      status=0;
      titlebar=1;
   } else if (winType == "3") {   // winType 3 is for footer like popups
      location=0;
      menubar=0;
      resizable=1;
      scrollbars=1;
      status=0;
      titlebar=1;
   } else {                       // if no arg is passed for winType
      location=1;
      menubar=1;
      resizable=1;
      scrollbars=1;
      status=1;
      titlebar=1;
   } 
   
   // Features to specify for a new window
   args = "width=" + width + ","
   + "height=" + height + ","
   + "location=" + location + ","
   + "menubar=" + menubar + ","
   + "resizable=" + resizable + ","
   + "scrollbars=" + scrollbars + ","
   + "status=" + status + ","
   + "titlebar=" + titlebar + ","
   + "toolbar=0,"
   + "hotkeys=0,"
   + "screenx=" + xposition + ","  //NN Only
   + "screeny=" + yposition + ","  //NN Only
   + "left=" + xposition + ","     //IE Only
   + "top=" + yposition;           //IE Only
   
// Performs the opening of the window (and closing of a window already opened for that page).
if (curPopupWindow != null) {
curPopupWindow.close();
}
curPopupWindow = window.open(url, winName, args, false);
curPopupWindow.focus();
}

// -------------------------------------------------------------------
// Virtual Pagination Script- By Dynamic Drive, available at: http://www.dynamicdrive.com
// Last updated: Nov 21st, 2008 to v2.0
// ** Adds ability to define multiple pagination DIVs (the secondary DIVs mirror primary DIV's contents)
// ** Last viewed page persistence, so last viewed page can be remembered/ recalled within browser session.
// ** Improvements to instance.navigate() to select a page using an arbitrary link or inside another script.
// ** Ability to select a page using a URL parameter (ie: target.htm?virtualpiececlass=index).
//
// PUBLIC: virtualpaginate()
// Main Virtual Paginate Object function.
// -------------------------------------------------------------------

document.write('<style type="text/css">' //write out CSS for class ".hidepeice" that hides pieces of contents within pages
	+'.hidepiece{display:none}\n'
	+'@media print{.hidepiece{display:block !important;}}\n'
	+'</style>')
	
function virtualpaginate(config){ //config: {piececlass:, piececontainer:, pieces_per_page:, defaultpage:, persist}
	this.piececlass=config.piececlass
	var elementType=(typeof config.piececontainer=="undefined")? "div" : config.piececontainer //The type of element used to divide up content into pieces. Defaults to "div"
	this.pieces=virtualpaginate.collectElementbyClass(config.piececlass, elementType) //get total number of divs matching class name
	//Set this.chunksize: 1 if "chunksize" param is undefined, "chunksize" if it's less than total pieces available, or simply total pieces avail (show all)
	this.chunksize=(typeof config.pieces_per_page=="undefined")? 1 : (config.pieces_per_page>0 && config.pieces_per_page<this.pieces.length)? config.pieces_per_page : this.pieces.length
	this.pagecount=Math.ceil(this.pieces.length/this.chunksize) //calculate number of "pages" needed to show the divs
	this.paginatediv=[], this.flatviewlinks=[], this.cpspan=[], this.selectmenu=[]
	this.persist=config.persist
	var persistedpage=virtualpaginate.getCookie("dd_"+this.piececlass) || 0
	var urlselectedpage=virtualpaginate.urlparamselect(this.piececlass) //returns null or index from: mypage.htm?piececlass=index
	this.currentpage=(typeof urlselectedpage=="number")? urlselectedpage : ((this.persist)? persistedpage : config.defaultpage)
	this.currentpage=(this.currentpage<this.pagecount)? parseInt(this.currentpage) : 0 //ensure currentpage is within range of available pages
	this.showpage(this.currentpage) //Show selected page
}

// -------------------------------------------------------------------
// PUBLIC: navigate(keyword)- Calls this.showpage() based on parameter passed (0=page1, 1=page2 etc, "next", "first", or "last")
// -------------------------------------------------------------------

virtualpaginate.prototype.navigate=function(keyword){
	var prevlinkindex=this.currentpage //Get index of last clicked on page
	if (keyword=="previous")
		this.currentpage=(this.currentpage>0)? this.currentpage-1 : (this.currentpage==0)? this.pagecount-1 : 0
	else if (keyword=="next")
		this.currentpage=(this.currentpage<this.pagecount-1)? this.currentpage+1 : 0
	else if (keyword=="first")
		this.currentpage=0
	else if (keyword=="last")
		this.currentpage=this.pagecount-1 //last page number
	else
		this.currentpage=parseInt(keyword)
	this.currentpage=(this.currentpage<this.pagecount)? this.currentpage : 0 //ensure pagenumber is within range of available pages
	this.showpage(this.currentpage)
	for (var p=0; p<this.paginatediv.length; p++){ //loop through all pagination DIVs
		if (this.flatviewpresent)
			this.flatviewlinks[p][prevlinkindex].className="" //"Unhighlight" previous page (before this.currentpage increments)
		if (this.selectmenupresent)
			this.selectmenu[p].selectedIndex=this.currentpage
		if (this.flatviewpresent)
			this.flatviewlinks[p][this.currentpage].className="selected" //"Highlight" current page
	}
}


// -------------------------------------------------------------------
// PUBLIC: buildpagination()- Create pagination interface by calling one or more of the paginate_build_() functions
// -------------------------------------------------------------------

virtualpaginate.prototype.buildpagination=function(divids, optnavtext){
	var divids=(typeof divids=="string")? [divids] : divids //force divids to be an array of ids
	var primarypaginatediv=divids.shift() //get first id within divids[]
	var paginaterawHTML=document.getElementById(primarypaginatediv).innerHTML
	this.paginate_build(primarypaginatediv, 0, optnavtext)
	for (var i=0; i<divids.length; i++){
		document.getElementById(divids[i]).innerHTML=paginaterawHTML
		this.paginate_build(divids[i], i+1, optnavtext)
	}
}

// -------------------------------------------------------------------
// PRIVATE utility functions
// -------------------------------------------------------------------

virtualpaginate.collectElementbyClass=function(classname, element){ //Returns an array containing DIVs with specified classname
	if (document.querySelectorAll){
		var pieces=document.querySelectorAll(element+"."+classname) //return pieces as HTMLCollection
	}
	else{
		var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i") //regular expression to screen for classname within element
		var pieces=[]
		var alltags=document.getElementsByTagName(element)
		for (var i=0; i<alltags.length; i++){
			if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
				pieces[pieces.length]=alltags[i] //return pieces as array
		}
	}
	return pieces
}

virtualpaginate.urlparamselect=function(vpclass){
	var result=window.location.search.match(new RegExp(vpclass+"=(\\d+)", "i")) //check for "?piececlass=2" in URL
	return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected virtual page's index
}

virtualpaginate.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return null
}

virtualpaginate.setCookie=function(name, value){
	document.cookie = name+"="+value
}

// -------------------------------------------------------------------
// PRIVATE: showpage(pagenumber)- Shows a page based on parameter passed (0=page1, 1=page2 etc)
// -------------------------------------------------------------------

virtualpaginate.prototype.showpage=function(pagenumber){
	var totalitems=this.pieces.length //total number of broken up divs
	var showstartindex=pagenumber*this.chunksize //array index of div to start showing per pagenumber setting
	var showendindex=showstartindex+this.chunksize-1 //array index of div to stop showing after per pagenumber setting
	for (var i=0; i<totalitems; i++){
		if (i>=showstartindex && i<=showendindex)
			this.pieces[i].style.display="block"
		else
			this.pieces[i].style.display="none"
	}
	if (this.persist){ //if persistence enabled
		virtualpaginate.setCookie("dd_"+this.piececlass, this.currentpage)
	}
	if (this.cpspan.length>0){ //if <span class="paginateinfo> element is present, update it with the most current info (ie: Page 3/4)
		for (var p=0; p<this.cpspan.length; p++)
			this.cpspan[p].innerHTML='Page '+(this.currentpage+1)+'/'+this.pagecount
	}
}

// -------------------------------------------------------------------
// PRIVATE: build() methods- Various methods to create pagination interfaces
// paginate_paginate_build()- Main build() paginate function
// paginate_output_flatview()- Accepts <span class="flatview"> element and populates it with sequential pagination links
// paginate_paginate_build_flatview()- Parses the modified <span class="flatview"> element and assigns click behavior to the pagination links
// paginate_build_selectmenu(paginatedropdown)- Accepts an empty SELECT element and turns it into pagination menu
// paginate_build_regularlinks(paginatelinks)- Accepts a collection of links and screens out/ creates pagination out of ones with specific "rel" attr
// paginate_build_cpinfo(cpspan)- Accepts <span class="paginateinfo"> element and displays current page info (ie: Page 1/4)
// -------------------------------------------------------------------

virtualpaginate.prototype.paginate_build=function(divid, divpos, optnavtext){
	var instanceOfBox=this
	var paginatediv=document.getElementById(divid)
	if (this.chunksize==this.pieces.length){ //if user has set to display all pieces at once, no point in creating pagination div
		paginatediv.style.display="none"
		return
	}
	var paginationcode=paginatediv.innerHTML //Get user defined, "unprocessed" HTML within paginate div
	if (paginatediv.getElementsByTagName("select").length>0) //if there's a select menu in div
		this.paginate_build_selectmenu(paginatediv.getElementsByTagName("select")[0], divpos, optnavtext)
	if (paginatediv.getElementsByTagName("a").length>0) //if there are links defined in div
		this.paginate_build_regularlinks(paginatediv.getElementsByTagName("a"))
	var allspans=paginatediv.getElementsByTagName("span") //Look for span tags within passed div
	for (var i=0; i<allspans.length; i++){
		if (allspans[i].className=="flatview")
			this.paginate_output_flatview(allspans[i], divpos, optnavtext)
		else if (allspans[i].className=="paginateinfo")
			this.paginate_build_cpinfo(allspans[i], divpos)
	}
	this.paginatediv[divpos]=paginatediv
}

virtualpaginate.prototype.paginate_output_flatview=function(flatviewcontainer, divpos, anchortext){
	var flatviewhtml=""
	var anchortext=anchortext || new Array()
	for (var i=0; i<this.pagecount; i++){
		if (typeof anchortext[i]!="undefined") //if custom anchor text for this link exists
			flatviewhtml+='<a href="#flatview" rel="'+i+'">'+anchortext[i]+'</a> ' //build pagination link using custom anchor text
		else
			flatviewhtml+='<a href="#flatview" rel="'+i+'">'+(i+1)+'</a> ' //build  pagination link using auto incremented sequential number instead
	}
	flatviewcontainer.innerHTML=flatviewhtml
	this.paginate_build_flatview(flatviewcontainer, divpos, anchortext)
}

virtualpaginate.prototype.paginate_build_flatview=function(flatviewcontainer, divpos, anchortext){
	var instanceOfBox=this
	var flatviewhtml=""
	this.flatviewlinks[divpos]=flatviewcontainer.getElementsByTagName("a")
	for (var i=0; i<this.flatviewlinks[divpos].length; i++){
		this.flatviewlinks[divpos][i].onclick=function(){
			var prevlinkindex=instanceOfBox.currentpage //Get index of last clicked on flatview link
			var curlinkindex=parseInt(this.getAttribute("rel"))
			instanceOfBox.navigate(curlinkindex)
			return false
		}
	}
	this.flatviewlinks[divpos][this.currentpage].className="selected" //"Highlight" current flatview link
	this.flatviewpresent=true //indicate flat view links are present
}

virtualpaginate.prototype.paginate_build_selectmenu=function(paginatedropdown, divpos, anchortext){
	var instanceOfBox=this
	var anchortext=anchortext || new Array()
	this.selectmenupresent=1
	for (var i=0; i<this.pagecount; i++){
		if (typeof anchortext[i]!="undefined") //if custom anchor text for this link exists, use anchor text as each OPTION's text
			paginatedropdown.options[i]=new Option(anchortext[i], i)
		else //else, use auto incremented, sequential numbers
			paginatedropdown.options[i]=new Option("Page "+(i+1)+" of "+this.pagecount, i)
	}
	paginatedropdown.selectedIndex=this.currentpage
	setTimeout(function(){paginatedropdown.selectedIndex=instanceOfBox.currentpage}, 500) //refresh currently selected option (for IE's sake)
	paginatedropdown.onchange=function(){
	instanceOfBox.navigate(this.selectedIndex)
	}
	this.selectmenu[divpos]=paginatedropdown
	this.selectmenu[divpos].selectedIndex=this.currentpage //"Select" current page's corresponding option
}

virtualpaginate.prototype.paginate_build_regularlinks=function(paginatelinks){
	var instanceOfBox=this
	for (var i=0; i<paginatelinks.length; i++){
		var currentpagerel=paginatelinks[i].getAttribute("rel")
		if (currentpagerel=="previous" || currentpagerel=="next" || currentpagerel=="first" || currentpagerel=="last"){ //screen for these "rel" values
			paginatelinks[i].onclick=function(){
				instanceOfBox.navigate(this.getAttribute("rel"))
				return false
			}
		}
	}
}

virtualpaginate.prototype.paginate_build_cpinfo=function(cpspan, divpos){
	this.cpspan[divpos]=cpspan
	cpspan.innerHTML='Page '+(this.currentpage+1)+'/'+this.pagecount
}

// -------------------------------------------------------------------
//  END PAGINATION
// -------------------------------------------------------------------






//-->