//
//  iWeb - iWebSite.js
//  Copyright (c) 2007 Apple Inc. All rights reserved.
//
//
//  This file includes a copy of the Prototype JavaScript framework:
//
//  Prototype JavaScript framework, version 1.5.0
//  (c) 2005-2007 Sam Stephenson
//
//  Prototype is freely distributable under the terms of an MIT-style license.
//  For details, see the Prototype web site: http://prototype.conio.net/

var windowsInternetExplorer=false;var isGecko=false;var isMozilla=false;var isFirefox=false;var isCamino=false;var isSafari=false;var isNS=false;var isWebKit=false;var isOpera=false;var isiPhone=false;var isEarlyWebKitVersion=false;var browserDetected=false;var listOfIE7FloatsFix=[];function detectBrowser()
{if(browserDetected===false)
{windowsInternetExplorer=false;var appVersion=navigator.appVersion;if((appVersion.indexOf("MSIE")!=-1)&&(appVersion.indexOf("Macintosh")==-1))
{var temp=appVersion.split("MSIE");browserVersion=parseFloat(temp[1]);windowsInternetExplorer=true;if(typeof(Node)=="undefined")
{Node={};Node.ELEMENT_NODE=1;Node.ATTRIBUTE_NODE=2;Node.TEXT_NODE=3;Node.CDATA_SECTION_NODE=4;Node.ENTITY_REFERENCE_NODE=5;Node.ENTITY_NODE=6;Node.PROCESSING_INSTRUCTION_NODE=7;Node.COMMENT_NODE=8;}}
else
{var ua=navigator.userAgent.toLowerCase();isGecko=(ua.indexOf('gecko')!=-1);isMozilla=(this.isGecko&&ua.indexOf("gecko/")+14==ua.length);isFirefox=(this.isGecko&&ua.indexOf("firefox")!=-1);isCamino=(this.isGecko&&ua.indexOf("camino")!=-1);isSafari=(this.isGecko&&ua.indexOf("safari")!=-1);isNS=((this.isGecko)?(ua.indexOf('netscape')!=-1):((ua.indexOf('mozilla')!=-1)&&(ua.indexOf('spoofer')==-1)&&(ua.indexOf('compatible')==-1)&&(ua.indexOf('opera')==-1)&&(ua.indexOf('webtv')==-1)&&(ua.indexOf('hotjava')==-1)));isOpera=!!window.opera;var matchResult=ua.match(/applewebkit\/(\d+)/);if(matchResult)
{isiPhone=(ua.indexOf("iphone")!=-1);isWebKit=true;webKitVersion=parseInt(matchResult[1]);isEarlyWebKitVersion=(webKitVersion<522);}}
browserDetected=true;}}
function shouldApplyCSSBackgroundPNGFix()
{detectBrowser();return(windowsInternetExplorer&&(browserVersion<7));}
function p_redirectTo(scheme,host,uri){window.location=scheme+"://"+host+uri;}
function IWPhotocastFromURL(protocol,domain,path)
{var iPhotoVersionMin=600;var iPhotoMimeTypePlugin="application/photo";var pluginInstalled=false;if(navigator.mimeTypes&&navigator.mimeTypes.length>0)
{var iPhoto=navigator.mimeTypes[iPhotoMimeTypePlugin];if(iPhoto)
{var description=iPhoto.description;try
{var components=description.split(" ");if(components&&components.length>1)
{var pluginVersion=components[1];if(pluginVersion>=iPhotoVersionMin)
{pluginInstalled=true;p_redirectTo("photo",domain,path);}}}
catch(exception)
{}}}
if(pluginInstalled==false)
{p_redirectTo(protocol,domain,path);}}
function loadCSS(file)
{var cssNode=document.createElement('link');cssNode.setAttribute('rel','stylesheet');cssNode.setAttribute('type','text/css');cssNode.setAttribute('href',file);document.getElementsByTagName('head')[0].appendChild(cssNode);}
function loadMozillaCSS(file)
{detectBrowser();if((isMozilla)||(isFirefox)||(isCamino))
{loadCSS(file);}}
function utf8sequence(c)
{if(c<=0x0000007f)return[c];if(c<=0x000007ff)return[(0xc0|(c>>>6)),(0x80|(c&0x3f))];if(c<=0x0000ffff)return[(0xe0|(c>>>12)),(0x80|((c>>>6)&0x3f)),(0x80|(c&0x3f))];if(c<=0x001fffff)return[(0xf0|(c>>>18)),(0x80|((c>>>12)&0x3f)),(0x80|((c>>>6)&0x3f)),(0x80|(c&0x3f))];if(c<=0x03ffffff)return[(0xf8|(c>>>24)),(0x80|((c>>>18)&0x3f)),(0x80|((c>>>12)&0x3f)),(0x80|((c>>>6)&0x3f)),(0x80|(c&0x3f))];if(c<=0x7fffffff)return[(0xfc|(c>>>30)),(0x80|((c>>>24)&0x3f)),(0x80|((c>>>18)&0x3f)),(0x80|((c>>>12)&0x3f)),(0x80|((c>>>6)&0x3f)),(0x80|(c&0x3f))];}
function utf8encode(s)
{var result=[];var firstSurrogate=0;for(var i=0;i<s.length;++i)
{var code=s.charCodeAt(i);if(firstSurrogate!=0)
{if((code>=0xDC00)&&(code<=0xDFFF))
{code=(firstSurrogate-0xD800)*0x400+(code-0xDC00)+0x10000;firstSurrogate=0;}}
else
{if((code<0xD800)||(code>0xDFFF))
{}
else if((code>=0xD800)&&(code<0xDC00))
{firstSurrogate=code;continue;}
else
{continue;}}
result=result.concat(utf8sequence(code));}
var resultString="";for(i=0;i<result.length;++i)
{resultString+=String.fromCharCode(result[i]);}
return resultString;}
function IELatin1Munge(UTF8String)
{var munged="";for(var i=0;i<UTF8String.length;i++)
{var c=UTF8String.charCodeAt(i);switch(c){case 0x0080:c=0x20AC;break;case 0x0081:break;case 0x0082:c=0x201A;break;case 0x0083:c=0x0192;break;case 0x0084:c=0x201E;break;case 0x0085:c=0x2026;break;case 0x0086:c=0x2020;break;case 0x0087:c=0x2021;break;case 0x0088:c=0x02C6;break;case 0x0089:c=0x2030;break;case 0x008A:c=0x0160;break;case 0x008B:c=0x2039;break;case 0x008C:c=0x0152;break;case 0x008D:break;case 0x008E:c=0x017D;break;case 0x008F:break;case 0x0090:break;case 0x0091:c=0x2018;break;case 0x0092:c=0x2019;break;case 0x0093:c=0x201C;break;case 0x0094:c=0x201D;break;case 0x0095:c=0x2022;break;case 0x0096:c=0x2013;break;case 0x0097:c=0x2014;break;case 0x0098:c=0x02DC;break;case 0x0099:c=0x2122;break;case 0x009A:c=0x0161;break;case 0x009B:c=0x203A;break;case 0x009C:c=0x0153;break;case 0x009D:break;case 0x009E:c=0x017E;break;case 0x009F:c=0x0178;break;}
munged+=String.fromCharCode(c);}
return munged;}
function IEConvertURLForPNGFix(urlString)
{var result=urlString;detectBrowser();if(windowsInternetExplorer)
{var decoded=decodeURI(urlString);if(decoded.match(/[^\x00-\x7f]/))
{result=IELatin1Munge(utf8encode(decodeURI(urlString)));}}
return result;}
function fixAllIEPNGs(transparentGif)
{detectBrowser();if(windowsInternetExplorer)
{for(var i=0;i<document.images.length;++i)
{if(document.images[i].src.slice(-4).toLowerCase()==".png")
{var img=$(document.images[i]);var fixPng=function(img)
{if(!img.originalSrc)
{if((img.style.width=="")&&(img.style.height==""))
{var width=img.width;var height=img.height;img.style.width=width+"px";img.style.height=height+"px";}
var filterName='progid:DXImageTransform.Microsoft.AlphaImageLoader';var filterParams='src="'+IEConvertURLForPNGFix(img.src)+'", sizingMethod="scale"';img.setFilter(filterName,filterParams);img.originalSrc=img.src;img.src=transparentGif;}};if(img.complete)
{fixPng(img);}
else
{img.onload=fixPng.bind(null,img);}}}}}
function toPixels(value)
{var converted=0;var px_per_pt=window.screen.logicalXDPI?(window.screen.logicalXDPI/72.0):1.3333;if(value.indexOf("px")>0)
{converted=parseFloat(value);}
else if(value.indexOf("pt")>0)
{converted=px_per_pt*parseFloat(value);}
else if(value.indexOf("in")>0)
{converted=72*px_per_pt*parseFloat(value);}
else if(value.indexOf("pc")>0)
{converted=12*px_per_pt*parseFloat(value);}
else if(value.indexOf("mm")>0)
{converted=2.83465*px_per_pt*parseFloat(value);}
else if(value.indexOf("cm")>0)
{converted=28.3465*px_per_pt*parseFloat(value);}
return converted;}
function toPixelsAtElement(element,value,vertical)
{var converted=0;if(value.indexOf("%")>0)
{var containerSize=0;if(vertical)
{containerSize=$(element.parentNode).getHeight();}
else
{containerSize=$(element.parentNode).getWidth();}
converted=containerSize*parseFloat(value)/100.0;}
else if(value.indexOf("em")>0)
{converted=parseFloat(value)*toPixels(Element.getStyle(element,'fontSize'));}
else
{converted=toPixels(value);}
return converted;}
function backgroundPositionDimension(oBlock,currentBGPosition,blockDimension,imageDimension)
{var position=0;if(currentBGPosition==='center')
{position=(blockDimension/2)-(imageDimension/2);}
else if((currentBGPosition==='right')||(currentBGPosition==='bottom'))
{position=blockDimension-imageDimension;}
else if((currentBGPosition==='left')||(currentBGPosition==='top'))
{position=0;}
else if(currentBGPosition.indexOf("px")>0)
{position=parseFloat(currentBGPosition);}
else if(currentBGPosition.indexOf("em")>0)
{position=parseFloat(currentBGPosition)*toPixels(oBlock.currentStyle.fontSize);}
else if(currentBGPosition.indexOf("%")>0)
{position=parseFloat(currentBGPosition)*blockDimension/100.0;}
else if((currentBGPosition.indexOf("pt")>0)||(currentBGPosition.indexOf("in")>0)||(currentBGPosition.indexOf("pc")>0)||(currentBGPosition.indexOf("cm")>0)||(currentBGPosition.indexOf("mm")>0))
{position=toPixels(currentBGPosition);}
return position;}
function elementHasCSSBGPNG(element)
{return(element.currentStyle&&element.currentStyle.backgroundImage&&(element.currentStyle.backgroundImage.indexOf('url(')!=-1)&&(element.currentStyle.backgroundImage.indexOf('.png")')!=-1));}
function fixupIEPNGBG(oBlock)
{if(oBlock)
{if(elementHasCSSBGPNG(oBlock))
{var currentBGImage=oBlock.currentStyle.backgroundImage;var currentBGRepeat=oBlock.currentStyle.backgroundRepeat;var currentBGPositionX=oBlock.currentStyle.backgroundPositionX;var currentBGPositionY=oBlock.currentStyle.backgroundPositionY;var urlStart=currentBGImage.indexOf('url(');var urlEnd=currentBGImage.indexOf(')',urlStart);var imageURL=currentBGImage.substring(urlStart+4,urlEnd);if(imageURL.charAt(0)=='"')
{imageURL=imageURL.substring(1);}
if(imageURL.charAt(imageURL.length-1)=='"')
{imageURL=imageURL.substring(0,imageURL.length-1);}
imageURL=IEConvertURLForPNGFix(imageURL);var overrideRepeat=false;var filterStyle="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
imageURL+"', sizingMethod='crop');";if(RegExp("/C[0-9A-F]{8}.png$").exec(imageURL)!==null)
{filterStyle="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
imageURL+"', sizingMethod='scale');";overrideRepeat=true;}
var fixupIEPNGBG_helper=function(img)
{var tileWidth=img.width;var tileHeight=img.height;var blockWidth=0;var blockHeight=0;if(oBlock.style.width)
{blockWidth=parseInt(oBlock.style.width,10);}
else
{blockWidth=oBlock.offsetWidth;}
if(oBlock.style.height)
{blockHeight=parseInt(oBlock.style.height,10);}
else
{blockHeight=oBlock.offsetHeight;}
var blockPaddingLeft=parseInt(oBlock.style.paddingLeft||0,10);if((blockWidth===0)||(blockHeight===0))
{return;}
var wholeRows=1;var wholeCols=1;var extraHeight=0;var extraWidth=0;if((currentBGRepeat.indexOf("no-repeat")!=-1)||((tileWidth===0)&&(tileHeight===0))||overrideRepeat)
{tileWidth=blockWidth;tileHeight=blockHeight;}
else if((currentBGRepeat.indexOf("repeat-x")!=-1)||(tileHeight===0))
{wholeCols=Math.floor(blockWidth/tileWidth);extraWidth=blockWidth-(tileWidth*wholeCols);tileHeight=blockHeight;}
else if(currentBGRepeat.indexOf("repeat-y")!=-1)
{wholeRows=Math.floor(blockHeight/tileHeight);extraHeight=blockHeight-(tileHeight*wholeRows);tileWidth=blockWidth;}
else
{wholeCols=Math.floor(blockWidth/tileWidth);wholeRows=Math.floor(blockHeight/tileHeight);extraWidth=blockWidth-(tileWidth*wholeCols);extraHeight=blockHeight-(tileHeight*wholeRows);}
var wrappedContent=document.createElement("div");var pngBGFixIsWrappedContentEmpty=true;wrappedContent.style.position="relative";wrappedContent.style.zIndex="1";wrappedContent.style.left="0px";wrappedContent.style.top="0px";wrappedContent.style.background="transparent";if(!isNaN(parseInt(oBlock.style.width,10)))
{wrappedContent.style.width=""+blockWidth+"px";}
if(!isNaN(parseInt(oBlock.style.height,10)))
{wrappedContent.style.height=""+blockHeight+"px";}
while(oBlock.hasChildNodes())
{if(oBlock.firstChild.nodeType==3)
{if(RegExp("^ *$").exec(oBlock.firstChild.data)===null)
{pngBGFixIsWrappedContentEmpty=false;}}
else
{pngBGFixIsWrappedContentEmpty=false;}
wrappedContent.appendChild(oBlock.firstChild);}
if(pngBGFixIsWrappedContentEmpty)
{wrappedContent.style.lineHeight="0px";}
var bgPositionX=backgroundPositionDimension(oBlock,currentBGPositionX,blockWidth,img.width);var bgPositionY=backgroundPositionDimension(oBlock,currentBGPositionY,blockHeight,img.height);bgPositionX-=blockPaddingLeft;var newMarkup="";for(var currentRow=0;currentRow<wholeRows;currentRow++)
{for(currentCol=0;currentCol<wholeCols;currentCol++)
{newMarkup+="<div class='pngtile' style="+"\"position: absolute; line-height: 0px; "+"width: "+tileWidth+"px; "+"height: "+tileHeight+"px; "+"left:"+(bgPositionX+(currentCol*tileWidth))+"px; "+"top:"+(bgPositionY+(currentRow*tileHeight))+"px; "+"filter:"+filterStyle+"\" > </div>";}
if(extraWidth!==0)
{newMarkup+="<div class='pngtile' style="+"\"position: absolute; line-height: 0px; "+"width: "+extraWidth+"px; "+"height: "+tileHeight+"px; "+"left:"+(bgPositionX+(currentCol*tileWidth))+"px; "+"top:"+(bgPositionY+(currentRow*tileHeight))+"px; "+"filter:"+filterStyle+"\" > </div>";}}
if(extraHeight!==0)
{for(currentCol=0;currentCol<wholeCols;currentCol++)
{newMarkup+="<div class='pngtile' style="+"\"position: absolute; line-height: 0px; "+"width: "+tileWidth+"px; "+"height: "+extraHeight+"px; "+"left:"+(bgPositionX+(currentCol*tileWidth))+"px; "+"top:"+(bgPositionY+(currentRow*tileHeight))+"px; "+"filter:"+filterStyle+"\" > </div>";}
if(extraWidth!==0)
{newMarkup+="<div class='pngtile' style="+"\"position: absolute; line-height: 0px; "+"width: "+extraWidth+"px; "+"height: "+extraHeight+"px; "+"left:"+(bgPositionX+(currentCol*tileWidth))+"px; "+"top:"+(bgPositionY+(currentRow*tileHeight))+"px; "+"filter:"+filterStyle+"\" > </div>";}}
oBlock.innerHTML=newMarkup;if(!pngBGFixIsWrappedContentEmpty)
{oBlock.appendChild(wrappedContent);}
oBlock.style.background="";}
var backgroundImage=new Image();backgroundImage.src=imageURL;if(backgroundImage.complete)
{fixupIEPNGBG_helper(backgroundImage);}
else
{backgroundImage.onload=fixupIEPNGBG_helper.bind(null,backgroundImage);}}}}
function fixupIEPNGBGsInTree(oAncestor,forceAutoFixup)
{if(shouldApplyCSSBackgroundPNGFix())
{try
{var allDivs=$A(oAncestor.getElementsByTagName('DIV'));if(isDiv(oAncestor))
{allDivs.push(oAncestor);}
allDivs.each(function(oNode)
{if(!$(oNode).hasClassName("noAutoPNGFix")||forceAutoFixup)
{fixupIEPNGBG(oNode);}});}
catch(e)
{}}}
function fixupAllIEPNGBGs()
{setTimeout(fixupIEPNGBGsInTree.bind(null,document),1);}
function optOutOfCSSBackgroundPNGFix(element)
{if(shouldApplyCSSBackgroundPNGFix())
{var allDivs=$A(element.getElementsByTagName("DIV"));allDivs.each(function(item)
{if(elementHasCSSBGPNG(item))
{$(item).addClassName("noAutoPNGFix");}});}}
function fixupIECSS3Opacity(strElementID)
{detectBrowser();if(windowsInternetExplorer)
{var oNode=$(strElementID);if(oNode&&(oNode.getStyle('opacity')<1))
{var opacity=oNode.getStyle('opacity');oNode.style.height=''+oNode.offsetHeight+'px';var targetNode=oNode;if(oNode.tagName.toLowerCase()=='img')
{targetNode=$(document.createElement('div'));targetNode.style.position=oNod