
var geoMap={US:{code:"",noResults:"No Shortcut found. Try a full search of apple.com.",viewAll:"View all search results"},AU:{code:"au"},NZ:{code:"nz"},CA_EN:{code:"ca",directory:"/ca"},CA_FR:{code:"ca",directory:"/ca/fr",viewAll:"Afficher tous les résultats"},DE:{code:"de",viewAll:"Alle Suchergebnisse"},UK:{code:"uk"},FR:{code:"fr",viewAll:"Afficher tous les résultats"},CH_DE:{code:"ce",viewAll:"Alle Suchergebnisse"},CH_FR:{code:"cr",viewAll:"Afficher tous les résultats"},IE:null,JP:{code:"jp",noResults:"ショートカットは見つかりませんでした。検索はこちら。",viewAll:"すべての検索結果を見る"},IT:{code:"it",viewAll:"Mostra tutti i risultati"},ES:{code:"es",viewAll:"Ver todos los resultados de búsqueda"},NL:{code:"nl",viewAll:"Toon alle zoekresultaten"},BE_FR:{code:"bf",viewAll:"Afficher tous les résultats"},BE_NL:{code:"bl",viewAll:"Toon alle zoekresultaten"},TW:null,LA:{code:"la"},KR:{code:"kr",noResults:"일치하는 검색결과가 없습니다. 다시 검색하기.",viewAll:"검색 결과 전체 보기."},SE:{code:"se",noResults:"Ingen genväg hittades. Prova att fulltextsöka på apple.com.",viewAll:"Visa alla sökresultat"},DK:{code:"dk",noResults:"Ingen genvej fundet. Prøv at søge på hele apple.com.",viewAll:"Vis alle søgeresultater"},FI:{code:"fi",noResults:"Ei oikotietä. Etsi koko apple.com.",viewAll:"Katso hakutulokset"},NO:{code:"no",noResults:"Fant ingen snarvei. Søk på hele apple.com.",viewAll:"Vis alle søkeresultater"},BR:{code:"br"},CN:null,HK:null,RU:{code:"ru"},PT:null,PO:null,TR:null,UA:null,RO:null,CZ:null,HU:null,BG:null,HR:null,GR:null,IS:null};


		var enhanceSearch=function(J){var H=function(W){var U=document.getElementById(W);		U.parentNode.removeChild(U);		};


		document.getElementById("g-search").setAttribute("action",J);		document.getElementById("g-search").setAttribute("method","GET");		H("search-oe");		H("search-access");		H("search-site");		H("search-lr");		};


		function loadShortcuts(){decorateGlobalSearchInput();		
		
		//if(typeof (searchCountry)=="undefined"){searchCountry="us";		}
		/*
if(geoMap[searchCountry.toUpperCase()].directory){
	var W=geoMap[searchCountry.toUpperCase()].directory;		
	}else{
		if(searchCountry!="us"){var W="/"+searchCountry.replace(/_/,"");
	}else{
		W="";
				}
				}
				*/

var J={"global":"http://www.google.is/search"};


/*				
var J={"global":"http://www.google.is/search","downloads":"http://www.apple.com/search/downloads/","iphone":"http://www.apple.com/search/iphone/","ipoditunes":"http://www.apple.com/search/ipoditunes/","mac":"http://www.apple.com/search/mac/","store":"http://www.apple.com/search/store/","support":"http://www.apple.com/search/support/"};
*/


		var H=J[searchSection]||"http://www.apple.com/search/";		
		
		enhanceSearch(H);		
		
		if((!navigator.userAgent.match(/iPhone/i))&&(typeof (deactivateSearchShortcuts)=="undefined"||!deactivateSearchShortcuts)){
			SearchShortcut.load();		
			}
			}function shortcutsPageLoader(J){
				var H=window.onload;		
				if(typeof window.onload!="function"){
					window.onload=J;		
					}else{
			//window.onload=function(){H();		J();		};


			}
		}
			shortcutsPageLoader(loadShortcuts);		
		var SearchShortcut={baseUrl:"http://www.apple.com/global/nav/scripts/shortcuts.php",minimumCharactersForSearch:0,entryDelay:150,currentRequest:false,descriptionCharacters:95,isIe:false,init:function(){
			this.fullSearchUrl=document.getElementById("globalsearch").getElementsByTagName("form")[0].getAttribute("action");		
			this.noResults=geoMap["US"].noResults;		
			this.viewAll=geoMap["US"].viewAll;
			
				if(typeof (searchCountry)!="undefined"&&searchCountry){
					this.noResults=geoMap[searchCountry.toUpperCase()].noResults||this.noResults;		this.viewAll=geoMap[searchCountry.toUpperCase()].viewAll||this.viewAll;		}this.html={results:document.getElementById("sp-results").getElementsByTagName("div")[0],input:document.getElementById("sp-searchtext")};


		if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){
			document.getElementById("sp-results").style.left="171px";
			this.isIe=true;		
			}
			this.pausedControllers=[];		},track:function(U,H){if(typeof (s_gi)=="undefined"||!s_gi){return ;		}var W="appleglobal";		var e="appleussearch";		var J=null;		if(typeof (searchCountry)!="undefined"&&searchCountry&&searchCountry!="US"){J=geoMap[searchCountry.toUpperCase()].code;		}
if(J){W="apple"+J+"global";		e="apple"+J+"search";		}
if(typeof (s_account)!="undefined"&&s_account.indexOf("appleussearch")==-1){s=s_gi(s_account+","+e);		}else{s=s_gi(W+","+e);		}s.prop4="";		s.g_prop4="";		s.prop6="";		s.g_prop6="";		s.pageName="";		s.g_pageName="";		s.pageURL="";		s.g_pageURL="";		s.g_channel="";		s.linkTrackVars="eVar2,eVar4,prop7,prop10";		s.eVar2="WWW-sc: "+U.toLowerCase();		s.prop7="WWW-sc: "+U.toLowerCase();		s.eVar4=H;		s.prop10=H;		s.tl(this,"o","Shortcut Search");		},go:function(H){SearchShortcut.track(SearchShortcut.searchText,H);		document.location=H;		},search:function(W){var H=this.baseUrl+"?q="+encodeURIComponent(W);		if(typeof (searchSection)!="undefined"&&searchSection){H+="&section="+searchSection;		}
if(typeof (searchCountry)!="undefined"&&searchCountry){H+="&geo="+searchCountry.toLowerCase();		}this.spin();		H+="&transport=js";		var J=document.getElementsByTagName("head")[0];		script=document.createElement("script");		script.id="xdShortcutContainer";		script.type="text/javascript";		script.src=H;		J.appendChild(script);		SearchShortcut.scriptLoadTest();		},scriptLoadTest:function(){var H=0;		var J=window.setInterval(function(){H++;		if(typeof (shortcutXml)!="undefined"){window.clearInterval(J);		}else{if(H>20){window.clearInterval(J);		document.getElementById("sp-search-spinner").style.display="none";		}}},50);		},loadXmlToDoc:function(J){var H;		if(window.ActiveXObject){H=new ActiveXObject("Microsoft.XMLDOM");		H.async="false";		H.loadXML(J);		}else{var W=new DOMParser();		H=W.parseFromString(J,"text/xml");		}
if(!this.html||!this.html.results){this.init();		}document.getElementById("sp-search-spinner").style.display="none";		this.term=H.getElementsByTagName("term")[0].firstChild.nodeValue;		this.xml=H.getElementsByTagName("search_results")[0];		this.parseResults(this.xml);		if(this.results){this.results.length>0?this.renderResults():this.renderNoResults();		}},spin:function(){document.getElementById("sp-search-spinner").style.display="block";		},parseResults:function(U){var W=U.getElementsByTagName("error");		if(W.length>0){SearchShortcut.hideResults();		return ;		}else{var u=U.getElementsByTagName("match");		this.results=new Array();		for(var e=0;		e<(u.length);		e++){var H=u[e];		var J={title:H.getAttribute("title"),url:H.getAttribute("url"),desc:H.getAttribute("copy"),category:H.getAttribute("category"),priority:H.getAttribute("priority"),image:H.getAttribute("image")};


		if(this.requestStrategy==3){J.url=decodeURIComponent(J.url);		}this.results.push(J);		}}},renderNoResults:function(){var U=this.noResults;		this.html.results.innerHTML="";		var J=document.createElement("ul");		J.className="sp-results";		listResult=document.createElement("li");		listResult.className="firstCat resultCat";		J.appendChild(listResult);		listResult=document.createElement("li");		listResult.id="sp-result-none";		listResult.className="viewall";		var H=document.createElement("div");		H.className="hoverbox";		var W=document.createElement("a");		W.href=this.fullSearchUrl+"?q="+encodeURIComponent(this.term);		W.innerHTML=U;		listResult.appendChild(H);		listResult.appendChild(W);		listResult.url=this.fullSearchUrl+"?q="+encodeURIComponent(this.term);		listResult.num=this.results.length;		listResult.onclick=function(){SearchShortcut.go(this.url);		};



		J.appendChild(listResult);		this.html.results.appendChild(J);		document.getElementById("globalsearch").className="active";		},hideAllQuicktimeMovies:function(){if(typeof (AC)!="undefined"&&typeof (AC.Quicktime)!="undefined"&&typeof (AC.Quicktime.controllers)!="undefined"){function C(i){var P=curtop=0;		if(i.offsetParent){P=i.offsetLeft;		curtop=i.offsetTop;		while(i=i.offsetParent){P+=i.offsetLeft;		curtop+=i.offsetTop;		}}return [P,curtop];		}function O(E,N,K,y,P,p,Y,T){var d=E+K;		var w=N+y;		var r=P+Y;		var k=p+T;		var M=Math.max(E,P);		var f=Math.max(N,p);		var x=Math.min(d,r);		var i=Math.min(w,k);		return x>M&&i>f;		}var H=AC.Quicktime.controllers;		var c=$("sp-results");		var t={width:328,height:448};


		var h=C(c);		var e=h[0]-328;		var U=h[1];		var W=v+t.width;		var J=u+t.height;		for(var A=H.length-1;		A>=0;		A--){var a=H[A].movie;		var G=Element.getDimensions(a);		var Z=C(a);		var v=Z[0];		var u=Z[1];		if(O(v,u,G.width,G.height,e,U,t.width,t.height)){this.pausedControllers.push(H[A]);		H[A].Stop();		H[A].movie.style.visibility="hidden";		}}}else{var q=document.getElementsByTagName("object");		for(A=0;		A<q.length;		A++){if(typeof (q[A].Stop)!="undefined"){q[A].Stop();		}try{if(typeof (q[A].getElementsByTagName("embed")[0].Stop)!="undefined"){q[A].getElementsByTagName("embed")[0].Stop();		}}catch(B){}q[A].style.visibility="hidden";		}}},showAllQuicktimeMovies:function(){if(typeof (AC)!="undefined"&&typeof (AC.Quicktime)!="undefined"&&typeof (AC.Quicktime.controllers)!="undefined"){for(var J=this.pausedControllers.length-1;		J>=0;		J--){this.pausedControllers[J].movie.style.visibility="visible";		if(navigator.userAgent.match(/Firefox/i)){setTimeout(this.pausedControllers[J].Play,100);		}else{this.pausedControllers[J].Play();		}}this.pausedControllers=[];		}else{var H=document.getElementsByTagName("object");		for(J=0;		J<H.length;		J++){H[J].style.visibility="visible";		if(typeof (H[J].Play)!="undefined"){H[J].Play();		}try{if(typeof (H[J].getElementsByTagName("embed")[0].Play)!="undefined"){H[J].getElementsByTagName("embed")[0].Play();		}}catch(W){}}}},startFlashFixTimer:function(){var J=0;		var H=setInterval(function(){SearchShortcut.flashDomRender();		J++;		if(J>50){clearInterval(H);		}},10);		},border:5,flashDomFix:function(){document.getElementById("sp-results").firstChild.firstChild.style.border="5px none red";		document.getElementById("globalsearch").onmousemove=function(){SearchShortcut.flashDomRender();		};


		},flashDomRender:function(){SearchShortcut.border%2==0?SearchShortcut.border++:SearchShortcut.border--;		var H=document.getElementById("sp-results").firstChild.firstChild;		if(H){H.style.border=SearchShortcut.border+"px none red";		}},itemSelected:false,renderResults:function(){this.html.results.innerHTML="";		var q=document.createElement("ul");		q.className="sp-results";		var G={};


		for(var C=0;		C<this.results.length;		C++){var B=this.results[C];		var O=unescape(B.desc);		var e="";		if(O.length>this.descriptionCharacters){O=O.substring(0,O.indexOf(" ",this.descriptionCharacters-11))+"&hellip;		";		e=unescape(B.desc);		}var U=unescape(B.title);		if(U.length>40){U=U.substring(0,U.indexOf(" ",30))+"&hellip;		";		}var v=document.createElement("li");		v.id="sp-result-"+C;		v.className="category-"+unescape(B.category).toLowerCase().replace(/\s+/g,"-");		var W=document.createElement("div");		W.className="hoverbox";		var u=document.createElement("img");		u.src=B.image;		u.title=e;		var h=document.createElement("span");		h.className="text";		var a=document.createElement("h4");		var c=document.createElement("a");		var J=document.createElement("p");		c.href=decodeURIComponent(B.url);		c.title=e;		c.onclick=function(){SearchShortcut.go(decodeURIComponent(B.url));		};


		c.innerHTML=U;		J.innerHTML=O;		J.title=e;		a.appendChild(c);		h.appendChild(a);		h.appendChild(J);		v.appendChild(W);		v.appendChild(u);		v.appendChild(h);		v.url=B.url;		v.num=C;		v.onmouseover=function(){SearchShortcut.itemSelected=true;		SearchShortcut.highlight(this);		};




		v.priority=parseInt(B.priority);		if(!G[B.category]){G[B.category]=new Array();		}G[B.category].push(v);		}var t="firstCat resultCat";		for(var A in G){if(!G.hasOwnProperty(A)){continue;		}v=document.createElement("li");		v.className=t;		v.innerHTML=unescape(A);		t="resultCat";		q.appendChild(v);		for(var H=0;		H<G[A].length;		H++){q.appendChild(G[A][H]);		}}v=document.createElement("li");		v.id="sp-result-"+this.results.length;		v.className="viewall";		var W=document.createElement("div");		W.className="hoverbox";		var c=document.createElement("a");		c.href=this.fullSearchUrl+"?q="+encodeURIComponent(this.term);		c.innerHTML=this.viewAll;		v.appendChild(W);		v.appendChild(c);		v.url=this.fullSearchUrl+"?q="+encodeURIComponent(this.term);		v.num=this.results.length;		v.onclick=function(){SearchShortcut.go(this.url);		};





		document.getElementById("globalsearch").className="active";		q.appendChild(v);		this.html.results.appendChild(q);		this.hideAllQuicktimeMovies();		if(typeof (flashOnPage)!="undefined"&&flashOnPage){this.flashDomFix();		this.startFlashFixTimer();		}},startKeystrokeTimer:function(){if(this.timeoutId){window.clearTimeout(this.timeoutId);		}this.timeoutId=window.setTimeout("SearchShortcut.commitKeystroke()",this.entryDelay);		},commitKeystroke:function(){this.search(this.searchText);		},hideResults:function(H,J){if(!this.html){this.init();		}this.selected=null;		document.getElementById("globalsearch").className="";		this.html.results.innerHTML="";		this.showAllQuicktimeMovies();		},highlight:function(H){H.className="hoverli";		},keyHighlight:function(H){if(this.selected){this.selected.className="";		}this.selected=H;		H.className="hoverli";		},unhighlight:function(H){H.className="";		},load:function(){var H=document.createElement("img");		H.src="http://images.apple.com/global/nav/images/spinner.gif";		H.width="11";		H.height="11";		H.border="0";		H.alt="*";		H.id="sp-search-spinner";		H.style.display="none";		document.getElementById("globalsearch").appendChild(H);		document.getElementById("g-search").onsubmit=function(J){return false;		};


		if(navigator.userAgent.match(/AppleWebKit/i)){document.getElementById("sp-searchtext").onkeydown=function(J){var W=typeof (event)!="undefined"?event["keyCode"]:J.keyCode;		if(!J){J=event;		}
if(W==13&&!J.altKey){if(J.target.value.length===0){return false;		}
if(SearchShortcut.selected){SearchShortcut.go(SearchShortcut.selected.url);		}else{SearchShortcut.hideResults();		document.getElementById("g-search").submit();		}}};


		}
		
		/*document.getElementById("sp-searchtext").onkeyup=function(J){var U=typeof (event)!="undefined"?event["keyCode"]:J.keyCode;		if(!J){J=event;		}
if(U==40&&SearchShortcut.results){try{J.preventDefault();		J.stopPropagation();		}catch(e){}
if(SearchShortcut.selected&&(SearchShortcut.results.length>SearchShortcut.selected.num+1)){SearchShortcut.keyHighlight(document.getElementById("sp-result-"+(SearchShortcut.selected.num+1)));		}
if(!SearchShortcut.selected&&SearchShortcut.results.length>0){SearchShortcut.keyHighlight(document.getElementById("sp-result-0"));		}SearchShortcut.flashDomRender();		}else{if(U==38&&SearchShortcut.results){try{J.preventDefault();		J.stopPropagation();		}catch(e){}
if(SearchShortcut.selected&&SearchShortcut.selected.num>0){SearchShortcut.keyHighlight(document.getElementById("sp-result-"+(SearchShortcut.selected.num-1)));		}SearchShortcut.flashDomRender();		}else{if(U==27){SearchShortcut.hideResults();		document.getElementById("sp-searchtext").value="";		}else{SearchShortcut.selected=false;		var W=document.getElementById("sp-searchtext").value;		W=W.replace(/[%\^\?\!\*\/<>\$]/ig,"");		W=W.replace(/^\s+/g,"").replace(/\s+$/g,"");		if(W.length<1&&SearchShortcut.html){SearchShortcut.html.results.innerHTML="";		document.getElementById("sp-search-spinner").style.display="none";		SearchShortcut.hideResults();		}else{if(W.length>SearchShortcut.minimumCharactersForSearch){SearchShortcut.searchText=W;		SearchShortcut.startKeystrokeTimer();		}}}}}};
		
		*/


		}};


		function decorateGlobalSearchInput(){var G=document.getElementById("sp-searchtext");		var e=null;		var U=0;		var a="Leita";		var C="";		if(navigator.userAgent.match(/AppleWebKit/i)){G.setAttribute("type","search");		if(!G.getAttribute("results")){G.setAttribute("results",U);		}
if(null!=a){G.setAttribute("placeholder",a);		G.setAttribute("autosave",C);		}G.onblur=function(){if(!SearchShortcut.itemSelected){SearchShortcut.hideResults();		}};


		}else{G.setAttribute("autocomplete","off");		e=document.createElement("input");		G.parentNode.replaceChild(e,G);		var J=document.createElement("span");		J.className="left";		var q=document.createElement("span");		q.className="right";		var v=document.createElement("div");		v.className="reset";		var H=document.createElement("div");		H.className="search-wrapper";		var u=G.value==a;		var W=G.value.length==0;		if(u||W){G.value=a;		H.className+=" blurred empty";		}H.appendChild(J);		H.appendChild(G);		H.appendChild(q);		H.appendChild(v);		G.onfocus=function(){var A=H.className.indexOf("blurred")>-1;		if(G.value==a&&A){G.value="";		}H.className=H.className.replace("blurred","");		};


		G.onblur=function(){if(!SearchShortcut.itemSelected){SearchShortcut.hideResults();		}
if(G.value==""){H.className+=" empty";		G.value=a;		}H.className+=" blurred";		};


		G.onkeydown=function(A){var h=typeof (event)!="undefined"?event["keyCode"]:A.keyCode;		if(!A){A=event;		}
if(h==13&&!A.altKey){var c=null;		if(A.target){c=A.target;		}else{if(A.srcElement){c=A.srcElement;		}}
if(c.value.length===0){return false;		}
if(SearchShortcut.selected){SearchShortcut.go(SearchShortcut.selected.url);		}else{SearchShortcut.hideResults();		document.getElementById("g-search").submit();		}return ;		}
if(G.value.length>=0){H.className=H.className.replace("empty","");		}t();		};


		var t=function(){return (function(A){var c=false;		if(!A){A=window.event;		}
if(A.type=="keydown"){if(A.keyCode!=27){return ;		}else{c=true;		}}G.blur();		G.value="";		H.className+=" empty";		G.focus();		});		};


		v.onmousedown=t();		if(e){e.parentNode.replaceChild(H,e);		}}}