function loadManuf(manufid){if(manufid){window.location=HTTP_LOCATION+"phones/"+manufid+".html"}}function loadManufForAllCat(manufIdWithPageCat){if(manufIdWithPageCat){window.location=HTTP_LOCATION+manufIdWithPageCat+".html"}}function loadCategory(catname){if(catname){window.location=HTTP_LOCATION+"category/"+catname+".html"}}function suggest(inputString){if(inputString.length==0){jQuery("#suggestions").fadeOut()}else{jQuery.post(HTTP_LOCATION+"support-scripts/getAutoSuggestList.php",{keyword:""+inputString+""},function(data){if(data.length>0){jQuery("#suggestions").fadeIn();jQuery("#suggestionsList").html(data);jQuery("#suggestionsList ul li").removeClass("itemhover");jQuery("#suggestionsList ul li a").removeClass("itemhover");jQuery("#suggestionsList ul li a").eq(currentSelection).addClass("itemhover");jQuery("#suggestionsList ul li").eq(currentSelection).addClass("itemhover")}})}}function fill(thisValue){jQuery("#keyword").val(thisValue);setTimeout("jQuery('#suggestions').fadeOut();",10)}function fill_n(thisValue){jQuery("#keyword_n").val(thisValue);setTimeout("jQuery('#suggestions').fadeOut();",10)}function myKeyupFunc(e){switch(e.keyCode){case 38:navigate("up");break;case 40:navigate("down");break;case 13:if(value!=""){fill(value)}break}}var currentSelection=0;var value="";jQuery(document).keydown(myKeyupFunc);for(var i=0;i<jQuery("#suggestionsList ul li a").size();i++){jQuery("#suggestionsList ul li a").eq(i).data("number",i)}jQuery("#suggestionsList ul li a").hover(function(){currentSelection=jQuery(this).data("number");setSelected(currentSelection)},function(){jQuery("#suggestionsList ul li a").removeClass("itemhover");currentUrl=""});function navigate(direction){if(jQuery("#suggestionsList ul li .itemhover").size()==0){currentSelection=-1}if(direction=="up"&&currentSelection!=-1){if(currentSelection!=0){currentSelection--}}else{if(direction=="down"){if(currentSelection!=jQuery("#suggestionsList ul li").size()-1){currentSelection++}}}setSelected(currentSelection)}function setSelected(currentSelection){jQuery("#suggestionsList ul li").removeClass("itemhover");jQuery("#suggestionsList ul li a").removeClass("itemhover");jQuery("#suggestionsList ul li a").eq(currentSelection).addClass("itemhover");jQuery("#suggestionsList ul li").eq(currentSelection).addClass("itemhover");value=jQuery("#suggestionsList ul li a").eq(currentSelection).attr("title")}jQuery(function(){jQuery("#keyword").keypress(function(e){var key=e.which?e.which:e.which;if(key=="13"){searchProducts(0);return false}})});jQuery(function(){jQuery("#keyword_n").keypress(function(e){var key=e.which?e.which:e.which;if(key=="13"){searchProducts_n(0);return false}})});jQuery(function(){jQuery("#pid").keypress(function(e){var key=e.which?e.which:e.which;if(key=="13"){searchProducts(1);return false}})});function searchProducts(pid){var url="";if(pid==1){var keyword=document.getElementById("pid").value}else{var keyword=document.getElementById("keyword").value}if(keyword!=""&&keyword!="keywords products code"){keyword=keyword.toLowerCase();keyword=keyword.replace(/[^a-zA-Z 0-9 -]+/g,"");keyword=keyword.replace(/^\s+|\s+$/g,"");var intIndexOfMatch=keyword.indexOf("  ");while(intIndexOfMatch!=-1){keyword=keyword.replace("  "," ");intIndexOfMatch=keyword.indexOf("  ")}keyword=keyword.replace(/ /g,"-");if(pid==1){url=HTTP_LOCATION+"search.html?q="+keyword+"&pid=1"}else{url=HTTP_LOCATION+"search.html?q="+keyword}window.location=url}else{alert("Kindly enter keywords to search!");document.getElementById("keyword").focus();return false}}function searchProducts_n(pid){var url="";if(pid==1){var keyword=document.getElementById("pid").value}else{var keyword=document.getElementById("keyword_n").value}if(keyword!=""&&keyword!="keywords products code"){keyword=keyword.toLowerCase();keyword=keyword.replace(/[^a-zA-Z 0-9 -]+/g,"");keyword=keyword.replace(/^\s+|\s+$/g,"");var intIndexOfMatch=keyword.indexOf("  ");while(intIndexOfMatch!=-1){keyword=keyword.replace("  "," ");intIndexOfMatch=keyword.indexOf("  ")}keyword=keyword.replace(/ /g,"-");if(pid==1){url=HTTP_LOCATION+"search_n.html?q="+keyword+"&pid=1"}else{url=HTTP_LOCATION+"search_n.html?q="+keyword}window.location=url}else{alert("Kindly enter keywords to search!");document.getElementById("keyword_n").focus();return false}}function displayTheRest(prefix,flag){var more_id="more-"+prefix;var hidden_id="hidden-"+prefix;if(flag==1){document.getElementById(more_id).style.display="none";document.getElementById(hidden_id).style.display="block"}else{document.getElementById(more_id).style.display="block";document.getElementById(hidden_id).style.display="none"}}var cX=0;var cY=0;var rX=0;var rY=0;function UpdateCursorPosition(e){cX=e.pageX;cY=e.pageY}function UpdateCursorPositionDocAll(e){cX=event.clientX;cY=event.clientY}if(document.all){document.onmousemove=UpdateCursorPositionDocAll}else{document.onmousemove=UpdateCursorPosition}function AssignPosition(d){if(self.pageYOffset){rX=self.pageXOffset;rY=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){rX=document.documentElement.scrollLeft;rY=document.documentElement.scrollTop}else{if(document.body){rX=document.body.scrollLeft;rY=document.body.scrollTop}}}if(document.all){cX+=rX;cY+=rY}if(parseInt(navigator.appVersion)>3){screenW=screen.width}else{if(navigator.appName=="Netscape"&&parseInt(navigator.appVersion)==3&&navigator.javaEnabled()){var jToolkit=java.awt.Toolkit.getDefaultToolkit();var jScreenSize=jToolkit.getScreenSize();screenW=jScreenSize.width}}cX=(screenW*48)/100;d.style.left=(cX)+"px";d.style.top=(cY-200)+"px"}function HideContent(d){if(d.length<1){return}document.getElementById(d).style.display="none"}function ShowContent(d,prod_id,cat_id){if(d.length<1){return}var dd=document.getElementById(d);AssignPosition(dd);dd.style.display="block";document.getElementById("prod_id").value=prod_id;document.getElementById("cat_id").value=cat_id}function ReverseContentDisplay(d){if(d.length<1){return}var dd=document.getElementById(d);AssignPosition(dd);if(dd.style.display=="none"){dd.style.display="block"}else{dd.style.display="none"}}function getModelsForManuf(manuf){$.ajax({type:"GET",url:HTTP_LOCATION+"support-scripts/getModelForManuf.php",data:({manuf:manuf}),success:function(res){document.getElementById("sel_model").innerHTML=res}})}var popUpWin=0;function popUpWindow(URLStr,left,top,width,height){var cat_id=document.getElementById("cat_id").value;var prod_id=document.getElementById("prod_id").value;var e=document.getElementById("drpcomp_manuf");var manuf_id=e.options[e.selectedIndex].value;if(e.selectedIndex==0){alert("Select manufacture please");e.focus();return false}var e=document.getElementById("drpModel");if(e.selectedIndex==0){e.focus();alert("Select model please");return false}var model_id=e.options[e.selectedIndex].value;var URLStr=HTTP_LOCATION+URLStr+"?model_id="+model_id+"&cat_id="+cat_id+"&prod_id="+prod_id+"&manuf_id="+manuf_id;if(popUpWin){if(!popUpWin.closed){popUpWin.close()}}popUpWin=open(URLStr,"popUpWin","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width="+width+", height="+height+", left="+left+", top="+top+", screenX="+left+", screenY="+top+"")};
