var jsvMaxcharLengthArray = Array();

var jsvIsIE501 = navigator.userAgent.indexOf("MSIE 5.01") > 0 ? true : false;
var jsvIsNN6 = navigator.userAgent.indexOf("Netscape6") > 0 ? true : false;
var jsvIsIE=document.all&&navigator.userAgent.indexOf("Opera")==-1;

//Event.observe(window, 'load', pws_jsfInit, false);

function pws_jsfTogglePage(self)
{
	if (jsvIsIE) 
	{
		var container = self.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
		var element1 = container.nextSibling;
		var element2 = element1.nextSibling;
		
		self.parentElement.parentElement.className="selected";
		if (self.parentElement.parentElement.nextSibling != null)
			self.parentElement.parentElement.nextSibling.className="";
		if (self.parentElement.parentElement.previousSibling != null)
			self.parentElement.parentElement.previousSibling.className="";
		
		
		if (element1.style.display == "none")
		{
			element1.style.display = "";
			element2.style.display = "none";
		} else {
			element1.style.display = "none";
			element2.style.display = "";
		}
	} else {
		var container = self.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
		var element1 = container.nextSibling.nextSibling;
		var element2 = element1.nextSibling.nextSibling;
		
		self.parentNode.parentNode.className="selected";
		if (self.parentNode.parentNode.nextSibling.nextSibling != null)
			self.parentNode.parentNode.nextSibling.nextSibling.className="";
		if (self.parentNode.parentNode.previousSibling.previousSibling != null)
			self.parentNode.parentNode.previousSibling.previousSibling.className="";
		
		if (element1.style.display == "none")
		{
			element1.style.display = "";
			element2.style.display = "none";
		} else {
			element1.style.display = "none";
			element2.style.display = "";
		}
	}
}

function pws_getElementsByName_iefix(tag, name)
{
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}

function pws_contractAll()
{
	var togs, contents;
	
	if (jsvIsIE)
	{
		togs = pws_getElementsByName_iefix("div", "reduceToggle");
		contents = pws_getElementsByName_iefix("div", "content");
	}
	else
	{
		togs = document.getElementsByName("reduceToggle");
		contents = document.getElementsByName("content");
	}
	
	for (i=0; i<togs.length; i++)
	{
		togs[i].style.display = "none";
		contents[i].style.display = "none";
	}
}

function pws_jsfToggleMenu(self)
{
	if (jsvIsIE) 
	{
		if (self.parentElement.parentElement.children[0].style.display == "none")
		{
			self.parentElement.parentElement.children[0].style.display = "";
			self.parentElement.parentElement.children[1].style.display = "none";
			self.parentElement.parentElement.parentElement.children[1].children[1].style.display = "none";
		} else {
			self.parentElement.parentElement.children[0].style.display = "none";
			self.parentElement.parentElement.children[1].style.display = "";
			self.parentElement.parentElement.parentElement.children[1].children[1].style.display = "";
		}
	} else {
		if (self.parentNode.parentNode.childNodes[1].style.display == "none")
		{
			self.parentNode.parentNode.childNodes[1].style.display = "";
			self.parentNode.parentNode.childNodes[3].style.display = "none";
			self.parentNode.parentNode.parentNode.childNodes[3].childNodes[3].style.display = "none";
		} else {
			self.parentNode.parentNode.childNodes[1].style.display = "none";
			self.parentNode.parentNode.childNodes[3].style.display = "";
			self.parentNode.parentNode.parentNode.childNodes[3].childNodes[3].style.display = "";
		}
	}
}

function pws_jsfInit()
{
	pws_jsfBalanceTables();
}

function pws_jsfBalanceTables()
{
	tables = document.getElementsByClassName("jsBalanceColumns");
	//exit if there is only one table
	if(tables.length<2)
	{
		return;
	}
	var firstTRFound;
	//count all letters in cells get maxium for each column
	for(a=0;a<tables.length;a++)
	{
		firstTRFound = false;
		//find TBODY
		for(b=0;b<tables[a].childNodes.length;b++)
		{
			if(tables[a].childNodes[b].nodeName=="TBODY")
			{
				//get first TR
				for(c=0;c<tables[a].childNodes[b].childNodes.length;c++)
				{
					if(tables[a].childNodes[b].childNodes[c].nodeName=="TR"&&!firstTRFound)
					{
						firstTRFound = true;
						pws_jsfCollectCellTextLength(tables[a].childNodes[b].childNodes[c]);
					}
				}
			}
		}
	}
	//convert values into percentages
	columnWidthArray = pws_jsfConvertValuesToPercentage(jsvMaxcharLengthArray);
	
	for(a=0;a<tables.length;a++)
	{
		firstTRFound = false;
		//find TBODY
		for(b=0;b<tables[a].childNodes.length;b++)
		{
			if(tables[a].childNodes[b].nodeName=="TBODY")
			{
				//get first TR
				for(c=0;c<tables[a].childNodes[b].childNodes.length;c++)
				{
					if(tables[a].childNodes[b].childNodes[c].nodeName=="TR"&&!firstTRFound)
					{
						//set column widths
						firstTRFound = true;
						pws_setColumnWidths(columnWidthArray,tables[a].childNodes[b].childNodes[c]);
						
					}
				}
			}
		}
	}
}

function pws_jsfConvertValuesToPercentage(theArray)
{
	totalValue = 0;
	for(f=0;f<theArray.length;f++)
	{
		totalValue+=theArray[f];
	}
	percArray = Array();
	for(f=0;f<theArray.length;f++)
	{
		percArray.push(Math.round(theArray[f]/totalValue*100));
	}
	return percArray;
}

function pws_setColumnWidths(widthArray,row)
{
	cell = 0;
	for(g=0;g<row.childNodes.length;g++)
	{
		if(row.childNodes[g].nodeName=="TD"||row.childNodes[g].nodeName=="TH")
		{
			if (row.childNodes[g].colSpan != null && row.childNodes[g].colSpan > 1)
			{
				var tempLength = 0;
				for (i=0; i<row.childNodes[g].colSpan; i++)
				{
					tempLength += widthArray[cell+i];
				}
				row.childNodes[g].style.width=tempLength+"%";
//				row.childNodes[g].style.width=(widthArray[cell]*row.childNodes[g].colSpan)+"%";
				cell+=row.childNodes[g].colSpan;
			}
			else
			{
				row.childNodes[g].style.width=widthArray[cell]+"%";
				cell++;
			}
		}
	}
}

function pws_jsfCollectCellTextLength(row)
{
	if(row==null)
	{
		return;	
	}
	firstPass = jsvMaxcharLengthArray.length==0?true:false;
	
	cell = 0;
	//go through each td/th
	for(d=0;d<row.childNodes.length;d++)
	{
		//find TD or TH
		if((row.childNodes[d].nodeName=="TD"||row.childNodes[d].nodeName=="TH"))
		{
			for(e=0;e<row.childNodes[d].childNodes.length;e++)
			{
				//find text node
				if(row.childNodes[d].childNodes[e].nodeType==3)
				{
					//alert(row.childNodes[d].childNodes[e].nodeValue);
					if(firstPass)
					{
						if (row.childNodes[d].colSpan != null && row.childNodes[d].colSpan > 1)
						{
							for (x=0; x<row.childNodes[d].colSpan; x++)
							{
								jsvMaxcharLengthArray.push((pws_getStringDisplayLength(row.childNodes[d].childNodes[e].nodeValue)/row.childNodes[d].colSpan));
							}
						}
						else
						{
							jsvMaxcharLengthArray.push(pws_getStringDisplayLength(row.childNodes[d].childNodes[e].nodeValue));
						}
					}
					else
					{
						
						if (row.childNodes[d].colSpan != null)
						{
							for (x=0; x<row.childNodes[d].colSpan; x++)
							{
								jsvMaxcharLengthArray[cell+x] = jsvMaxcharLengthArray[cell+x]<(pws_getStringDisplayLength(row.childNodes[d].childNodes[e].nodeValue) / row.childNodes[d].colSpan)?(pws_getStringDisplayLength(row.childNodes[d].childNodes[e].nodeValue) / row.childNodes[d].colSpan):jsvMaxcharLengthArray[cell+x];
							}
							cell+=row.childNodes[d].colSpan;
						} 
						else
						{
							jsvMaxcharLengthArray[cell] = jsvMaxcharLengthArray[cell]<pws_getStringDisplayLength(row.childNodes[d].childNodes[e].nodeValue)?pws_getStringDisplayLength(row.childNodes[d].childNodes[e].nodeValue):jsvMaxcharLengthArray[cell];
							cell++;
						}
					}
				}
			}
		}
	}
	//find the next row in the table and recurse
	pws_jsfCollectCellTextLength(pws_getNextSibling(row,"TR"));
}


function pws_getStringDisplayLength(theString)
{
	theLength = 0;
	for(i=0;i<theString.length;i++)		
	{
		theLength+=(pws_getCharDisplayLength(theString.charAt(i)));
	}
	return theLength;
}

function pws_getCharDisplayLength(theChar)
{
	switch(theChar)
	{
		case 'i':
		case 'j':
		case 'i':
		case 'j':
		case '.':
		case ',':
			return 1;
		case 'f':
		case 'r':
		case 't':
			return 3;
		case 'k':
		case 's':
		case 'J':
			return 4;
		case 'i':
		case 'j':
		case 'l':
		case 'I':
		case '.':
		case ',':
		case 'f':
		case 'r':
		case 't':
		case 'k':
		case 's':
		case 'J':
		case 'a':
		case 'b':
		case 'c':
		case 'd':
		case 'e':
		case 'g':
		case 'h':
		case 'n':
		case 'o':
		case 'p':
		case 'q':
		case 'u':
		case 'v':
		case 'x':
		case 'Y':
		case 'z':
		case 'E':
		case 'F':
		case 'L':
		case 'P':
		case 'T':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
		case '(':
		case ')':
		case '/':
			return 5;
		case 'B':
		case 'C':
		case 'D':
		case 'H':
		case 'K':
		case 'N':
		case 'R':
		case 'S':
		case 'U':
		case 'V':
		case 'X':
		case 'Z':
		case '0':
		case '%':
			return 6;
		case 'm':
		case 'A':
		case 'G':
		case 'M':
		case 'O':
		case 'Q':
		case 'Y':
			return 8;
		case 'w':
		case 'W':
			return 11;
		default:
			return 0;
	}
}

function pws_getNextSibling(object,siblingNodeName)
{
	if(object.nextSibling!=null)
	{
		if(object.nextSibling.nodeName==siblingNodeName)
		{
			return object.nextSibling;
		}
		else
		{
			return pws_getNextSibling(object.nextSibling,siblingNodeName);
		}
	}
}

function pws_hbap_popupWin(helpUrl ,widthSize, heightSize) {
var search_string=location.search;
var rs_url="";
var wedTrends_unit = "";
var reg = /WT.mc_id/;
	if(search_string == null || search_string.length == 0){
		rs_url = helpUrl;
	}
	else{
		var mat_index = search_string.search(reg);
		if (mat_index >= 0) {
			var temp = search_string.substring(mat_index);	
			var index_and = temp.search(/&/);
			if(index_and > 0){
				wedTrends_unit = temp.substring(0, index_and);			
			} else {
				wedTrends_unit = temp;			
			}	
			if (helpUrl.indexOf("?") > 0) {	
				rs_url=helpUrl + "&" + wedTrends_unit ;
			} else {
				rs_url=helpUrl + "?" + wedTrends_unit ;
			}
		
		}else {
			rs_url = helpUrl;
		}	
	}
   if(widthSize != null && heightSize != null){   
   	var popWin = window.open(rs_url,"onlinehsbc","width="+widthSize+",height="+heightSize);   	
   } else {   
   	var popWin = window.open(rs_url);
   }	 
	popWin.focus();		
}

function pws_show_TandC(loc,windoc) {

if(loc==null || windoc==null) {
	return ;
}

var urlpath=loc.hash;

if ( (urlpath == null) || (urlpath == "")) {
	return;
}
<!--urlpath must have at least one word after "#"-->
if ( urlpath.length < 2) {
	return;	
}
var id = urlpath.substring(1);
var show_postfix="_s";
var hide_postfix="_h";
var content_postfix="_c";



if ((windoc.getElementById(id+show_postfix)!= null) && (windoc.getElementById(id+hide_postfix)!= null)
		 && (windoc.getElementById(id+content_postfix)!= null) ){

	if ((windoc.getElementById(id+show_postfix).style!= null) && (windoc.getElementById(id+hide_postfix).style!= null)
			&& (windoc.getElementById(id+content_postfix).style!= null) ) {
			
			if ( (windoc.getElementById(id+show_postfix).style.display!= null) 
				&& (windoc.getElementById(id+hide_postfix).style.display!= null) 
				&& (windoc.getElementById(id+content_postfix).style.display!= null) ) {
				
				windoc.getElementById(id+show_postfix).style.display = "none";
				windoc.getElementById(id+hide_postfix).style.display = "";
				windoc.getElementById(id+content_postfix).style.display = "";
				
			}
	}
}



}

function pws_digitalOrder_en(formname, cookievalue)
{
	pws_popupNewBrowser('', 'yes', 'no', 'yes', 'no', 'no', 'yes', 800, 500);

	pws_setCookie('FromWebSite', cookievalue, '/', '.hsbc.com.hk', 'true', 0);

	document.forms[formname].action = 'https://www.qualityassurance.ebank.hsbc.com.hk:30000/servlet/onlinehsbc?LANGTAG=en&COUNTRYTAG=US';
	document.forms[formname].submit();	
}

function pws_digitalOrder_zh(formname, cookievalue)
{
	pws_popupNewBrowser('', 'yes', 'no', 'yes', 'no', 'no', 'yes', 800, 500);

	pws_setCookie('FromWebSite', cookievalue, '/', '.hsbc.com.hk', 'true', 0);

	document.forms[formname].action = 'https://www.qualityassurance.ebank.hsbc.com.hk:30000/servlet/onlinehsbc?LANGTAG=zh&COUNTRYTAG=HK';
	document.forms[formname].submit();	
}


function pws_popupNewBrowser(url, status, location, scroll, mbar, toolbar, resize, width, height, winname)
{
	!winname? winname='nb':winname=winname;
	nb=window.open(url, winname, 'status=' + status + ',location=' + location + ',scrollbars=' + scroll + ',menubar=' + mbar + ',toolbar=' + toolbar + ',resizable=' + resize + ',height=' + height + ',width=' + width + ',left=20,top=20');
	nb.focus();
}

function pws_setCookie(name, value, path, domain, secure, expires)
{
    document.cookie = name + '=' + escape(value) +
    ((path) ? '; path=' + path : '') +
    ((domain) ? '; domain=' + domain : '') +
    ((secure) ? ';secure' : '')+
    ((expires) ? ';expires=' + expires.toGMTString() : '') ;
}

function pws_logon_en() {
	pws_popupNewBrowser('https://www.qualityassurance.ebank.hsbc.com.hk:30000/servlet/onlinehsbc?LANGTAG=en&COUNTRYTAG=US', 'yes', 'no', 'yes', 'no', 'no', 'yes', 800, 500);
}

function pws_logon_zh() {
	pws_popupNewBrowser('https://www.qualityassurance.ebank.hsbc.com.hk:30000/servlet/onlinehsbc?LANGTAG=zh&COUNTRYTAG=HK', 'yes', 'no', 'yes', 'no', 'no', 'yes', 800, 500);
}

function pws_popupPdf(pdfUrl ,windowName, winProperties) {

var targetUrl=it_fullContextPath.substring(0,it_fullContextPath.length-1) + pdfUrl;
var hsbcheader='\n'
+ '    <html>\n'
+ '	    <script language="JavaScript" src="' + wt_header_url +'"><\/script>\n'
+ '	    <SCRIPT LANGUAGE="JavaScript">\n'
+ '		HSBC.SITE.rgn="HBAP";\n'
+ '		HSBC.SITE.subrgn="AMH";\n'
+ '		HSBC.SITE.cnty="HKSAR";\n'
+ '	        HSBC.SITE.ent="HSBC";\n'
+ '             HSBC.LOG.dcsuri="' + pdfUrl + '";\n'
+ '		HSBC.SITE.brand="HSBC";\n'
+ '  	  	HSBC.DCS.ID="dcsur62uf00000s5nnzq4hvrl_6i5x";\n'
+ '    <\/SCRIPT>\n'
+ '    <script language="JavaScript" src="' + wt_footer_url + '"><\/SCRIPT>'
+ '     <body onload="window.location=\'' + targetUrl + '\';"><\/body>'
+ '    </html>\n'
+ '    \n';

   var popWin;
   if(winProperties != null && winProperties.length>0){   
   	popWin = window.open('','_blank',winProperties);   		
   } else {   
   	popWin = window.open('');   	
   }
  	popWin.document.write(hsbcheader);
   	popWin.document.close(); 	
	popWin.history.go(0); 
	popWin.focus();		 
	
}

function pws_transitPage(transitType, formname, fieldname, targetUrl,  width, height, winname){
	switch(transitType){
		case "TransitPulldown":
			if(formname == null || formname == "") {
				alert("Invalid parameters for TransitPage('transitType',???,'fieldname', 'targetUrl', 'width', 'height')");
			} else if(fieldname == null || fieldname == ""){
				alert("Invalid parameters for TransitPage('transitType','formname',???, 'targetUrl', 'width', 'height')");
			} else{
				var idx = document.forms[formname].elements[fieldname].selectedIndex;
				var v = document.forms[formname].elements[fieldname][idx].value;
				if(v != ""){					
					if (v.indexOf("?targetPage=") > 0){
						!winname? winname="nb":winname=winname;
						nb=window.open(v, winname, "status=no,location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no,height=" + height + ",width=" + width + ",left=20,top=20");
						nb.focus();
					}else{
						alert("Please specify the target page using '?targetPage='.");
					}
					
				}
		
			}
			break;
		case "TransitClickOn":
		
			if(targetUrl == null || targetUrl == ""){
				alert("Invalid parameters for TransitPage('transitType','formname','fieldname', ???, 'width', 'height')");
			}else{
					if (targetUrl.indexOf("?targetPage=") > 0){
						!winname? winname="nb":winname=winname;
						nb=window.open(targetUrl, winname, "status=no,location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no,height=" + height + ",width=" + width + ",left=20,top=20");
						nb.focus();
					}else{
						alert("Please specify the target page using '?targetPage='.");
					}				
			}
			break;
				
		default:
			break;	
		
	}
}

function pws_transitPage_Close()
{
	self.close();
}

function pws_targetPage(){
var search_string=location.search;
var target_page = "";
var indicator = "targetPage=";
var target_ind = search_string.indexOf(indicator);
if( target_ind > 0){
	temp = search_string.substring(indicator.length + 1);	
	var index_and = temp.search(/&/);
	if(index_and > 0){
		target_page = temp.substring(0, index_and) + "?" + temp.substring((index_and+1), temp.length);
	} else {
		target_page = temp;
	}
	
}else{
	target_page = "http://www.hsbc.com";
}
var openwin = window.open(target_page);
openwin.focus();
}

//originally default.js
var jsContractImgUrl = "../_images/en/contact_close.gif";
var jsExpandImgUrl = "../_images/en/contact_open.gif"; 

function jsfExplorerShowHide(id)
{
	imgObj=null;
	divObj=null;
	classObj=null;
	
	if(document.getElementById("jsIdExplorerShowHideDiv"+id))
	{
		divObj = document.getElementById("jsIdExplorerShowHideDiv"+id);
	}
	if(document.getElementById("jsIdExplorerShowHideClass"+id))
	{
		classObj = document.getElementById("jsIdExplorerShowHideClass"+id);
	}
	if(document.getElementById("jsIdShowHideImg"+id))
	{
		imgObj = document.getElementById("jsIdShowHideImg"+id);
	}
	if(divObj.style.display=="none")
	{
		if(divObj)
		{
			divObj.style.display = 'block';
		}			
		if(classObj)
		{	
			classObj.className="expanded";
		}
		if(imgObj)
		{
			imgObj.src = jsExpandImgUrl;
		}
	}
	else
	{
		if(divObj)
		{
		divObj.style.display = 'none';
		}
		if(classObj)
		{
		classObj.className = classObj.className.replace("expanded", "");
		}
		if(imgObj)
		{
			imgObj.src = jsContractImgUrl;
		}
	}
}

reelImages = new Array("../_images/en/img_reel_01.jpg","../_images/en/img_reel_02.jpg");
reelCaptions = new Array("Caption 1 goes here Lorem ipsum dolor sit amet, consectetuer adipiscing elit.","Caption 2 goes here Lorem ipsum dolor sit amet, consectetuer adipiscing elit.");
var reelCount = 0;
var imageCaption

function jsfShowReelLoad(){
	if (document.getElementById('imageNavigator')){
		reel = document.getElementById('imageNavigator');
		reel.style.display = 'block';
		imageCaption = document.getElementById('imageCaption');
		imageCaption.innerHTML = reelCaptions[0];
		imageCaption.style.display = 'block';
	}

}


function jsfMoveReel(direction){
	
	
	

	var imageReel = document.getElementById('imageReel');

	if (direction == "next"){
		
		
		if (reelCount < (reelImages.length - 1)) {
			
			imageReel.src = reelImages[++reelCount];		
			
			imageCaption = document.getElementById('imageCaption');
			imageCaption.innerHTML = reelCaptions[reelCount];
			imageReel.alt = reelCaptions[reelCount];
		
		
			reelLinkPrev = document.getElementById('reelPrev');
			
			reelLinkPrev.className = "";
			
			/*reelLinkPrev.class = "";*/
			reelLinkNext = document.getElementById('reelNext');
			if (reelCount == (reelImages.length - 1)) {
				

				reelLinkNext.className = "hide";
				/*reelLinkNext.class = "hide";*/
			} else {
				reelLinkNext.className = "";
				/*reelLinkNext.class = "";*/
			}	
		}
	}
	
	if (direction == "prev"){
		if (reelCount > 0) {
			imageReel.src = reelImages[--reelCount];
			 
			imageCaption = document.getElementById('imageCaption');
			imageCaption.innerHTML = reelCaptions[reelCount];
			imageReel.alt = reelCaptions[reelCount];
			
			reelLinkNext = document.getElementById('reelNext');
			reelLinkNext.className = "";
		/*	reelLinkNext.class = "";*/
		
		reelLinkPrev = document.getElementById('reelPrev');
		if (reelCount == 0) {
				
				reelLinkPrev.className = "hide";
				/*reelLink.class = "hide";*/
			} else {
				reelLinkPrev.className = "";
				/*reelLink.class = "";*/
			}	
		}
	}
}

		function Init_Items_Array()
		{
			var arrayToReturn = new Array();
			
			//get hold of the wrapping node
			var wrapperNode = document.getElementById( this.mainContainerEleId );
						
			//find the divs within the wrapping node
			var divsArray = wrapperNode.getElementsByTagName( "div" );
			
			var itemsArrayCount = 0;
			
			//go through the array and inspect the class name
			for( var i=0; i<divsArray.length; i++ )
			{
				if( divsArray[i].className == 'rotatorItem' )
				{
					arrayToReturn[itemsArrayCount] = divsArray[i];
					itemsArrayCount++;
				}
			}
			
			return arrayToReturn;
		}

		function Show( itemPosition )
		{
			//add one to the current position so we can use this number in the nav
			this.intCurrentPosition = itemPosition;
									
			//go through the global array of rotation items
			for( var i=0; i<this.objItemsArray.length; i++ )
			{
				if( i != itemPosition )
				{
					this.objItemsArray[i].style.display = "none";
				}
				else
				{
					this.objItemsArray[i].style.display = "block";
				}
			}
			
			//draw the nav
			this.drawNav();
		}

		//writes the navigation for the rotation items
		function Draw_Nav()
		{
			//find the element and the span within it
			var navList = document.getElementById( this.navEleId ).getElementsByTagName( "A" );
			var prevItem = navList[0];
			var nextItem = navList[1];
			if( this.intCurrentPosition+1<this.objItemsArray.length && this.intCurrentPosition-1>=0 )//when you can go forwards and backwards
			{
				prevItem.className = "";
				nextItem.className = "";
			}
			else if( this.intCurrentPosition+1<this.objItemsArray.length )//if it is the first element change the previus button to class="hide"
			{
				//console.log( "Can go forward" );
				prevItem.className = "hide";
				nextItem.className = "";
			}
			else if( this.intCurrentPosition-1>=0 )//if it is the last element change the next button to class="hide"
			{
				//console.log( "Can go backwards" );
				prevItem.className = "";
				nextItem.className = "hide";
			}
			else //only one image in reel
			{
				prevItem.className = "hide";
				nextItem.className = "hide";
			}
		}
		
		function Do_Forward()
		{
			this.intCurrentPosition+1<this.objItemsArray.length?this.show( this.intCurrentPosition+1 ):this.show( this.intCurrentPosition );
			return false;
		}
		
		function Do_Back()
		{
			this.intCurrentPosition-1>=0?this.show( this.intCurrentPosition-1 ):this.show( this.intCurrentPosition );
			return false;
		}
		
		function ItemRotatorObj( intCurrentPosition, mainContainerEleId, navEleId, prevId, nextId )
		{
			//init obj properties
			this.intCurrentPosition = intCurrentPosition;
			this.mainContainerEleId = mainContainerEleId;
			this.navEleId = navEleId;
			this.prevId = prevId;
			this.nextId = nextId;
			
			//assign methods to class
			this.initItemsArray = Init_Items_Array;
			this.show = Show;
			this.doForward = Do_Forward;
			this.doBack = Do_Back;
			this.drawNav = Draw_Nav;
			
			//init the array using a class method
			this.objItemsArray = this.initItemsArray();
			
			//do the stuff for first load
			this.show( 0 );
			
			//show the nav
			document.getElementById( this.navEleId ).style.display = "block";
		}
		
		//global vars
		var myItemRotatorObj;
		

if (window.addEventListener)
{
	window.addEventListener("load", jsfOnLoad, false);
}
else
{
	if (window.attachEvent)
	{
		window.attachEvent("onload", jsfOnLoad);
	}
	else
	{
	if (document.getElementById)
		{
			window.onload = jsfOnLoad;
		}
	}
}


function show()
{
self.location = document.form2.navigation1.value;
return false;
}


function jsfOnLoad()
{
	
	for(i=1;i<20;i++)
	{
		if(divObj = document.getElementById("jsIdExplorerShowHideDiv"+i))
		{
			jsfExplorerShowHide(i);
		}
	}
	if( document.getElementById( "jsRotationHolder" ) )
	{
		myItemRotatorObj = new ItemRotatorObj( 0, "jsRotationHolder", "jsRotationNav", "reelPrev", "reelNext" );
	}
	
	jsfShowReelLoad(); 
}

function showtip(id)
{
if(id.selectedIndex==2)
{
document.getElementById('s1').style.visibility='visible';
}
else
{
document.getElementById('s1').style.visibility='hidden';

}
}
function pws_rollover(n) {
	document.rollimg.src = window['image'+n].src;
	document.getElementById('caption').innerHTML = cap[n];
}
