
function searchHtml(headstrCurrencytemp){   
document.write("<form action='http://post.dinodirect.com/Search.cfm?cur="+headstrCurrencytemp+"' method='post' name='seForm' id='seForm' onsubmit='return topsearchSubmit()'>");
document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
document.write("<tr><td>");
document.write('<select name="ProductTypeID" id="ProductTypeID" class="bt_keyword_box01">');
document.write("<option value='0'>");
document.write("All Categories");
document.write("</option>");
document.write('<option value="8778" >Baby </option><option value="7915" >Cameras & Camcorders</option><option value="7620" >Car Accessories</option><option value="7267" >Cell Phones & PDAs</option><option value="7165" >Clothing, Shoes & Accessories</option><option value="7429" >Computers & Networking</option><option value="11723" >Cool Gadgets</option><option value="7788" >Electronics</option><option value="10166" >Gifts & Holiday Supplies</option><option value="7975" >Health & Beauty</option><option value="7654" >Home & Garden</option><option value="7766" >Jewelry & Watches</option><option value="10596" >Novelties</option><option value="7135" >Office Supplies</option><option value="10977" >Personalized Gifts</option><option value="7497" >Sporting Goods</option><option value="7353" >Toys & Hobbies</option><option value="7307" >Video Games</option>');
document.write('</select><label></label></td><td width="80%" align="right"><div style="float:left; width:100%;"><label>');
document.write('<input name="productname" id="productname" type="text" autocomplete="off" value="Please enter the keywords" onfocus="topsearchFocus(this.value)" onblur="topsearchBlur(this.value)" onkeydown="hrefkey(event)" onkeyup="searchkey(event,this.value,headstrCurrency)" class="bt_keyword_box02" style="color:#ccc"/>');
document.write('</label></div></td><td>');
document.write('<div class="index_btnGo">');
document.write('<span class="f_L btngL"></span>');
document.write('<span class="f_L btngM"><input class="btn_inp btngP tit14b" type="submit" value="GO" onclick="return  topsearchSubmit()"/></span>');
document.write('<span class="f_L btngR"></span>');
document.write('<div class="autoHeight"></div>');
document.write('</div>');
document.write('</td></tr></table>');
document.write('</form>');                  
}
var rowNo=-1;
function hrefkey(evt){
evt=(evt)?evt:((window.event) ? window.event:"");
var key=evt.keyCode?evt.keyCode:evt.which;
    if(key==13){
    var message=document.getElementById("keymessage");
if(message == null){
}else{
var lis=message.getElementsByTagName("li");
for(var k=0;k < lis.length;k++){
        if(message.getElementsByTagName("li")[rowNo%lis.length].style.backgroundColor == "#fffada"){
            window.lacation.href=message.getElementsByTagName("li")[rowNo%lis.length].id;
            }
        }
    }
  }
}
var timeout;
function searchkey(evt,str,CurCurrency){
clearTimeout(timeout);
timeout = setTimeout("keywordsearch('"+evt+"','"+str+"','"+CurCurrency+"')",1000);
}
function keywordsearch(evt,str,CurCurrency){
var ProductType=document.getElementById("ProductTypeID").value;
var productnames=document.getElementById("productname").value;
evt=(evt)?evt:((window.event) ? window.event:"");
var key=evt.keyCode?evt.keyCode:evt.which;
if(key==8){
objValue = document.getElementById("productname").value;
if(objValue.length==0){
           if(document.getElementById("keysearch")){
            editMarkClass(0);
document.getElementById("searchs").innerHTML="";
document.getElementById("keysearch").style.display="none";
            }
return;
}
        if(trim(str) != ""){
var url="/thinksearchNew";
url=url+"?key="+str+"&ProductType="+ProductType+"&productnames="+productnames+"&cur="+CurCurrency;
url=url+"&sid="+Math.random();
$.ajax({
  type:'post',
  url:url,
      data:'',
      error:function(XMLHttpRequest, textStatus, errorThrown){
   AlertInfoAdd("Search Product AJAX Error."+XMLHttpRequest.status,31,0,XMLHttpRequest.responseText);
   },
  success:stateChanged
});
            }
}
else if(key==38){
var message=document.getElementById("keymessage");
if(message == null){
}else{
var lis=message.getElementsByTagName("li");
for(var k=0;k < lis.length;k++){
message.getElementsByTagName("li")[k].style.backgroundColor="#FFFFFF";
        document.getElementById("searchLeft"+k).style.display="none";
}
if(rowNo <= 0) 
{ 
rowNo++; 
}
if(rowNo==0){
message.getElementsByTagName("li")[rowNo%lis.length].style.backgroundColor="#fffada";
            document.getElementById("searchLeft"+rowNo%lis.length).style.display="block";
            rowNo=lis.length*10-1;
}else{
message.getElementsByTagName("li")[--rowNo%lis.length].style.backgroundColor="#fffada";
            document.getElementById("searchLeft"+rowNo%lis.length).style.display="block";
}
document.getElementById("productname").value=trim(message.getElementsByTagName("li")[rowNo%lis.length].title);
}
}else if(key==40){
var message=document.getElementById("keymessage");
if(message == null){
}else{
var lis=message.getElementsByTagName("li");
for(var k=0;k < lis.length;k++){
message.getElementsByTagName("li")[k].style.backgroundColor="#FFFFFF";
            document.getElementById("searchLeft"+k).style.display="none";
}
message.getElementsByTagName("li")[++rowNo%lis.length].style.backgroundColor="#fffada";
        document.getElementById("searchLeft"+rowNo%lis.length).style.display="block";
document.getElementById("productname").value=trim(message.getElementsByTagName("li")[rowNo%lis.length].title);
}
}else{
if(str.length==0){
}else{
    if(trim(str) != ""){
var url="/thinksearchNew";
url=url+"?key="+str+"&ProductType="+ProductType+"&productnames="+productnames+"&cur="+CurCurrency;
url=url+"&sid="+Math.random();
$.ajax({
  type:'post',
  url:url,
      data:'',
      error:function(XMLHttpRequest, textStatus, errorThrown){
   AlertInfoAdd("Search Product AJAX Error."+XMLHttpRequest.status,31,0,XMLHttpRequest.responseText);
   },
  success:stateChanged
});
}
    }
  }
}

function choose(id){
rowNo=id;
var message=document.getElementById("keymessage");
if(message == null){
}else{
var lis=message.getElementsByTagName("li");
for(var k=0;k < lis.length;k++){
            document.getElementById("searchLeft"+k).style.display="none";
}
        document.getElementById("searchLeft"+id).style.display="block";
}
}


function timestop(){
setTimeout("ysetCreateValues()",200);
}
function ysetCreateValues(){
if(document.getElementById("keysearch")){
    editMarkClass(0);
document.getElementById("keysearch").style.display="none";
    }
}

function stateChanged(responseText){
if(trim(responseText).indexOf("null") != -1){
         if(document.getElementById("keysearch")){
         editMarkClass(0);
document.getElementById("keysearch").style.display="none";
         }
 return;
}
        if(document.getElementById("keysearch")){
        editMarkClass(1);
document.getElementById("searchs").innerHTML=responseText;
        document.getElementById("keysearch").style.display="block";
        }
}

function topsearchFocus(sValue){
if(trim(sValue) == 'Please enter the keywords') {document.getElementById("productname").value='';document.getElementById("productname").style.color = 'black';}
}
function topsearchBlur(sValue){
if(trim(sValue) =='')  {document.getElementById("productname").value='Please enter the keywords';document.getElementById("productname").style.color = '#cccccc';}
timestop();
}
function topsearchSubmit(){
    if(document.getElementById('productname').value.replace( /^\s*#/, '') == 'Please enter the keywords'
     || document.getElementById('productname').value.replace( /^\s*#/, '') == ''){
        alert('You must enter an item or topic in the search field!');return false;
    }else{
    var proType = document.getElementById('ProductTypeID');
    dinoSearchEngne.saveSubmitCookie(0
        ,proType[proType.selectedIndex].value
        ,proType[proType.selectedIndex].text
        ,document.getElementById('productname').value);
    document.getElementById('seForm').submit();
    }
}
function editMarkClass(t){
if(document.getElementById("indexmarketing")){
        if(t==1){
        document.getElementById("indexmarketing").className='index_marketing index_marketing_show2';
        }else{
        document.getElementById("indexmarketing").className='index_marketing';
        }
    }
if(document.getElementById("indexmarketing0")){
        if(t==1){
        document.getElementById("indexmarketing0").className='index_marketing0 index_marketing_show2';
        }else{
        document.getElementById("indexmarketing0").className='index_marketing0';
        }
    }
    if(document.getElementById("indexmarketing1")){
        if(t==1){
        document.getElementById("indexmarketing1").className='index_marketing1 index_marketing_show2';
        }else{
        document.getElementById("indexmarketing1").className='index_marketing1';
        }
    }
    if(document.getElementById("indexmarketing2")){
        if(t==1){
        document.getElementById("indexmarketing2").className='index_marketing2 index_marketing_show2';
        }else{
        document.getElementById("indexmarketing2").className='index_marketing2';
        }
    }
    if(document.getElementById("indexmarketing3")){
        if(t==1){
        document.getElementById("indexmarketing3").className='index_marketing3 index_marketing_show2';
        }else{
        document.getElementById("indexmarketing3").className='index_marketing3';
        }
    }
    if(document.getElementById("indexmarketing4")){
        if(t==1){
        document.getElementById("indexmarketing4").className='index_marketing4 index_marketing_show2';
        }else{
        document.getElementById("indexmarketing4").className='index_marketing4';
        }
    }
}
searchHtml(headstrCurrency);


