var chekHash=1;var url="";var oldURL="";var xmlObj="";var myInt="";var clientName="";var projectName="";var clientList="";var industryList="";var serviceList="";document.onload=checkURL();document.onclick=startLookingUrl;document.onkeydown=startLookingUrl;$("html, body").keypress(function(b){var a=(window.event)?event.keyCode:b.keyCode;if(a==27&&document.getElementById("blackout").style.display=="block"){closeDescription();startLookingUrl()}});function closeDescription(){var a="";a=window.location.hash;a=a.substring(a.indexOf("#/")+2,a.lastIndexOf("/"));a="#"+a.substring(a.indexOf("/"),a.length);window.location.hash=a}function checkURL(){temp=window.location.href;if(temp.search("#")<0){window.location.hash="#/featured"}startLookingUrl()}function startLookingUrl(){clearInterval(myInt);if(chekHash){myInt=setInterval(function(){currentURL=window.location.href;if(url!=currentURL&&xmlObj!=""){clearInterval(myInt);checkForHash(currentURL)}},1)}}function checkForHash(currentURL){setGoogleAnalytic(currentURL);url=currentURL;var tempArray=new Array();var tempString="";if(currentURL.search("#")>=0){currentURL=currentURL.substring(currentURL.indexOf("#")+2);tempArray=currentURL.split("/");tempString=tempArray[0]+"(";for(i=1;i<tempArray.length;i++){if((i+1)==tempArray.length){tempString+="'"+tempArray[i]+"'"}else{tempString+="'"+tempArray[i]+"',"}}tempString+=");";eval(tempString)}}function setGoogleAnalytic(a){if(currentURL.search("#")>=0){tpURl=a.substring(0,a.indexOf("/#"));tpURl=tpURl.substring(tpURl.lastIndexOf("/"));a=tpURl+a.substring(a.indexOf("#")+1)}pageTracker._trackPageview(a)}function setBlank(b,a){if(a){return b.replace(/ /g,"_")}else{b=decodeURI(b);return b.replace(/_/g," ")}}function getAllProjectList(){clientList=xmlObj.getAllProject();showList(clientList)}function getFeaturedProjectList(){clientList=xmlObj.getFeaturedProject();showList(clientList)}function getClientProjectList(a){if(a!="*"){clientList=xmlObj.getClientProject(a);showList(clientList)}}function getIndustryProjectList(a){if(a!="*"){clientList=xmlObj.getIndustryProject(a);showList(clientList)}}function getServiceProjectList(a){if(a!="*"){clientList=xmlObj.getServiceProject(a);showList(clientList)}}function showList(a){document.getElementById("projects").innerHTML=a;if(document.getElementById("projects").offsetHeight<300){document.getElementById("projects").style.height=464+"px"}if(document.getElementById("projects").getElementsByTagName("a").length<=0){a="<a class='project'  ><img src='/images/portfolio/noProject.jpg'></a>"}document.getElementById("projects").innerHTML=a;setThumbEffect()}function fadeInList(){aNo++;if(aNo<aObj.length){$(aObj[aNo]).fadeIn("def",fadeInList)}}function setURL(a){if(a.value!="*"){switch(a.name){case"clientList":window.location.hash="#/client/"+setBlank(a.value,1);break;case"industryList":window.location.hash="#/industry/"+setBlank(a.value,1);break;case"serviceList":window.location.hash="#/service/"+setBlank(a.value,1);break}}}function setTitle(a){document.title=a+" : Paper Plane Solutions"}function all(){if(oldURL!=url){oldURL=window.location.href;getAllProjectList();resetComboButton();document.getElementById("allBtn").className="current"}checkAndSetTopUrlValue("all")}function featured(){if(oldURL!=url){oldURL=window.location.href;getFeaturedProjectList();resetComboButton();document.getElementById("fprojectBtn").className="current"}checkAndSetTopUrlValue("Portfolio")}function client(a){a=setBlank(a,0);if(oldURL!=url){oldURL=window.location.href;a=(a!="")?a:"all";a=(setCombo("clientList",a))?a:"all";getClientProjectList(a)}checkAndSetTopUrlValue(a)}function industry(a){a=setBlank(a,0);if(oldURL!=url){oldURL=window.location.href;a=(a!="")?a:"all";a=(setCombo("industryList",a))?a:"all";getIndustryProjectList(a)}checkAndSetTopUrlValue(a)}function service(a){a=setBlank(a,0);if(oldURL!=url){oldURL=window.location.href;a=(a!="")?a:"all";a=(setCombo("serviceList",a))?a:"all";getServiceProjectList(a)}checkAndSetTopUrlValue(a)}function checkAndSetTopUrlValue(a){if(a=="all"){topURL="<a href='#/all' class='lvl1'>Portfolio</a> / All Projects";setTitle("Portfolio / All projects")}else{if(a=="Portfolio"){topURL="Portfolio";setTitle("Portfolio")}else{topURL="<a href='#/featured' class='lvl1'>Portfolio</a> / "+a;setTitle("Portfolio / "+a)}}setTopURL(topURL);hideDiv()}function setTopURL(a){document.getElementById("body").getElementsByTagName("h1")[0].innerHTML=a}function setCombo(a,b){resetComboButton();comboObj=document.getElementById(a);if(comboObj.value!=b){for(l=0;l<comboObj.length;l++){if(comboObj[l].value==b){comboObj[l].selected=true;return true}}if(l==comboObj.length){comboObj[comboObj.length-1].selected=true;return false;comboBox="all"}}return true}var comboArray=new Array("clientList","industryList","serviceList");function resetComboButton(){for(i=0;i<comboArray.length;i++){comboObj=document.getElementById(comboArray[i]);comboObj[0].selected=true}if(document.getElementById("fprojectBtn")!=null){document.getElementById("fprojectBtn").className=""}if(document.getElementById("allBtn")!=null){document.getElementById("allBtn").className=""}}function displayDescription(cType,cValue,nodeNo){if(oldURL==""){tempString=cType+"(";tempString+="'"+cValue+"'";tempString+=");";eval(tempString)}generateDiv();document.getElementById("blackout").style.display="block";document.getElementById("slides").style.display="block";projectDescTxt=xmlObj.getProjectDesc(nodeNo);document.getElementById("slides").innerHTML=projectDescTxt;$("#slider").easySlider();tempCValue=(cValue=="all")?"All Projects":setBlank(cValue,0);if(cValue!=""){topURL="<a href='#/featured' class='lvl1'>Portfolio</a> / <a href='#/"+cType+"/"+cValue+"' class='lvl2'>"+tempCValue+"</a> / "+projectName;setTitle("Portfolio / "+tempCValue+" / "+projectName)}else{if(cType=="all"){topURL="<a href='#/all' class='lvl1'>Portfolio</a> / "+clientName+" / "+projectName;setTitle("Portfolio / "+clientName+" / "+projectName)}else{topURL="<a href='#/featured' class='lvl1'>Portfolio</a> / "+clientName+" / "+projectName;setTitle("Portfolio / "+clientName+" / "+projectName)}}setTopURL(topURL)}function projectDesc(a,b,c){moveUp(a,b,c)}function moveUp(a,b,d){var c=$("body").height();$("html, body").animate({scrollTop:0},"normal","",function(){displayDescription(a,b,d)})}function projectDescF(a,b){moveUp(a,"",b)}function generateDiv(){if(document.getElementById("blackout")==null){boxDiv=document.createElement("DIV");boxDiv.setAttribute("id","blackout");contentDiv=document.createElement("DIV");contentDiv.setAttribute("id","slides");document.body.appendChild(boxDiv);document.body.appendChild(contentDiv);$("#blackout").click(function(){if(document.getElementById("blackout").style.display=="block"){closeDescription()}})}document.getElementById("slides").style.top=document.getElementById("secondary").offsetTop+"px";document.getElementById("blackout").style.top=document.getElementById("secondary").offsetTop+"px";document.getElementById("blackout").style.height=(document.getElementById("leg").offsetTop-document.getElementById("secondary").offsetTop)+"px"}function hideDiv(){if(document.getElementById("blackout")!=null){document.getElementById("blackout").style.display="none";document.getElementById("slides").style.display="none"}}function setThumbEffect(){$(".project").hover(function(){$(".caption",this).stop().animate({top:"130px"},{queue:false,duration:160})},function(){$(".caption",this).stop().animate({top:"180px"},{queue:false,duration:160})})}function getClientList(){clientList=xmlObj.getClientList();if(clientList.length>0){genrateComboBox(clientList,"clientList","by Client")}else{genrateComboBox("","clientList","by Client")}}function getIndustryList(){industryList=xmlObj.getIndustryList();if(industryList.length){genrateComboBox(industryList,"industryList","by Industry")}else{genrateComboBox("","industryList","by Industry")}}function getServiceList(){serviceList=xmlObj.getServiceList();if(serviceList.length){genrateComboBox(serviceList,"serviceList","by Service")}else{genrateComboBox("","serviceList","by Service")}}function genrateComboBox(a,b,c){combo="";comboObj=document.getElementById(b);comboObj.options[0]=new Option(c,"*");if(a!=""){for(i=0;i<a.length;i++){comboObj.options[i+1]=new Option(a[i],a[i])}}};