var today=new Date(); var timerId=null; var timerdelay=1500; var keywords=""; var spelled=""; var currentid=""; var firstimage=0; var nbimagesperpage=20; var nbmaxpages=20; var fileTypes=["bmp","gif","png","jpg","jpeg","tif","tiff"]; var ilanguage="en"; var language="un"; var insite="0"; var uploaded=0; var clientid=Math.random()*1000*today+''; var pid="418957"; var callads=0; var standardMode=true; var iFilter=[1,1,1,1,1];
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');};
function InitClientId(){ var pos=clientid.lastIndexOf("."); if (pos!=-1){clientid=clientid.substring(0,pos);}}
function FormatNumber(nStr){ nStr+=''; x=nStr.split('.'); x1=x[0]; x2=x.length>1?'.'+x[1]:''; var rgx= /(\d+)(\d{3})/; while(rgx.test(x1)){x1=x1.replace(rgx,'$1'+' '+'$2');}
return (x1+x2);}
function BodyLoad(){ InitClientId();document.search.kwd.focus();if(document.location.hash!=""){var kwds=document.location.hash.split("#");if(kwds.length!=0&&kwds[1].trim().length!=0){document.search.kwd.value=decodeURIComponent(kwds[1].trim());submitForm(0,false);}}}
function CCreate(){ var request=false; try{request=new ActiveXObject('Msxml2.XMLHTTP');}
catch(err2){try{request=new ActiveXObject('Microsoft.XMLHTTP');}
catch(err3){if(typeof XMLHttpRequest!="undefined")try{request=new XMLHttpRequest();}
catch(err1){alert("The current settings of your Internet browser don't allow to run a Web2.0 application...");request=false;}}}
return request;}
function CLoadHTML(url,dsp){ var xhr=CCreate(); xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200){dsp(xhr.responseText);}}; xhr.open("GET",url,true); xhr.send(null);}
function CLoad(url,dsp){ var xhr=CCreate(); xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200){dsp(xhr.responseXML);}}; xhr.open("GET",url,true); xhr.send(null);}
function TrySpelledForm(){ document.search.kwd.value=spelled; spelled="";submitForm(0,false);}
function InitTimer(){ firstimage=0; insite="0"; if(timerId!=null)clearTimeout(timerId); timerId=self.setTimeout("submitForm(0,false)",timerdelay);}
function Help(){ var url="http://www.cydral.com/onlinehelp.html"; CLoadHTML(url,displayHelp);}
function chgeMenu(menu,option){var mname="cmenu"+menu;document.getElementById(mname+iFilter[menu]).innerHTML="&nbsp; "+document.getElementById(mname+iFilter[menu]).innerHTML.replace(/^[^\s]+\s/g,'').trim();document.getElementById(mname+iFilter[menu]).style.fontWeight="normal";iFilter[menu]=option;document.getElementById(mname+iFilter[menu]).innerHTML="&nbsp;&raquo; "+document.getElementById(mname+iFilter[menu]).innerHTML.replace(/^[^\s]+\s/g,'').trim();document.getElementById(mname+iFilter[menu]).style.fontWeight="bold";submitForm(0,true);return false;}
function submitForm(first,newselect){ document.search.kwd.value=document.search.kwd.value.trim();if(document.search.kwd.value.length!=0){document.location.hash=encodeURIComponent(document.search.kwd.value); document.title="Cydral: "+document.search.kwd.value;}else{document.location.hash=" "; document.title="Cydral - Web Image Search";} if(document.search.kwd.value.length!=0){if(!standardMode&&!isUrlImg(document.search.kwd.value)){document.getElementById("StopWords").innerHTML="The submitted image URL should be like this: 'http://www.website.com/image.jpg'";return;}else if(standardMode&&isUrlImg(document.search.kwd.value)){document.getElementById("StopWords").innerHTML="Try the 'Reverse Search' mode to retrieve same or edited images";return;}else{document.getElementById("StopWords").innerHTML="&nbsp;";}} firstimage=first;if(timerId!=null)clearTimeout(timerId);timerId=null;if(uploaded!=2&&isUrlImg(document.search.kwd.value)){if(uploaded==1){var tmp=document.search.kwd.value;document.search.reset();document.search.kwd.value=tmp;document.search.pic.src="";}insite="0";uploaded=2;currentid=clientid;}else if(uploaded==2&&!isUrlImg(document.search.kwd.value)){uploaded=0;currentid="";document.getElementById("Thumbnail").src="http://www.cydral.com/img/nu.gif";} if(document.search.kwd.value!=""&&keywords==document.search.kwd.value&&!newselect) return; keywords=document.search.kwd.value; if(keywords==""){ document.getElementById("Spell").innerHTML="&nbsp;";spelled="";document.getElementById("StopWords").innerHTML="&nbsp;";document.getElementById("UserMsg").innerHTML=""; document.getElementById("Results").innerHTML="<strong>Images</strong>"; document.getElementById("Images").innerHTML="&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;";if (currentid==""&&uploaded==0)return;}
document.getElementById("SearchInProgress").innerHTML="<img src='http://www.cydral.com/img/pg.gif'/><strong>&nbsp;&nbsp;Search in progress...</strong>"; var url="http://www.cydral.com/xmlsearch.cgi?kwd="+encodeURIComponent(document.search.kwd.value); if(currentid!="")url+="&id="+currentid; if(uploaded!=0)url+="&uploaded="+parseInt(uploaded,10); if(document.search.rlang[1].checked){language="en";}else{language="un";}url+="&page="+firstimage+"&count="+nbimagesperpage+"&ilang="+ilanguage+"&lang="+language+"&adultFtr="+iFilter[0]+"&colorFtr="+iFilter[1]+"&sizeFtr="+iFilter[2]+"&typeFtr="+iFilter[3]+"&formFtr="+iFilter[4]+"&insiteFtr="+insite+"&pid="+pid; if(isUrlImg(document.search.kwd.value)){CLoad(url,displayWeb);}else{CLoad(url,display);}}
function sort(id){ resetFields(false); insite="0"; uploaded=0; currentid=id; document.getElementById("Thumbnail").src="http://www.cydral.com/cache.cgi?id="+id; keywords=""; submitForm(0,false);}
function sortHome(id){ resetFields(false); insite="1"; uploaded=0; currentid=id; document.getElementById("Thumbnail").src="http://www.cydral.com/cache.cgi?id="+id; keywords=""; submitForm(0,false);}
function cbir(id){ resetFields(false); insite="0"; uploaded=0; currentid=id; document.search.kwd.value=""; document.search.pic.src=""; document.getElementById("Thumbnail").src="http://www.cydral.com/cache.cgi?id="+id; keywords=""; submitForm(0,false);}
function setFtrs(){for(var i=0;i<=4;i++){if(i==0&&!standardMode&&iFilter[i]!=3){chgeMenu(0,3);} else if(standardMode&&iFilter[i]!=1){chgeMenu(i,1);}}}
function resetFields(chgMn){var tmp=document.search.kwd.value;document.search.reset();if(chgMn) setFtrs();if(!isUrlImg(tmp)){document.search.kwd.value=tmp;}else{keywords="";}insite="0";uploaded=0;currentid="";document.getElementById("SearchInProgress").innerHTML="&nbsp;";document.getElementById("Thumbnail").src="http://www.cydral.com/img/nu.gif";document.search.pic.src="";document.getElementById("Spell").innerHTML="&nbsp;";spelled="";document.getElementById("UserMsg").innerHTML="";document.getElementById("StopWords").innerHTML="&nbsp;";document.getElementById("Results").innerHTML="<strong>Images</strong>";document.getElementById("Images").innerHTML="&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;";}
function resetImage(){currentid="";resetFields(true);if(document.search.kwd.value.length!=0&&!isUrlImg(document.search.kwd.value)){ keywords="";submitForm(0,false);}}
function displayNavBar(totalResults){ var increment=((totalResults%nbimagesperpage)!=0?1:0); var totalPages=parseInt(totalResults/nbimagesperpage,10)+increment; var currentPage=parseInt(firstimage/nbimagesperpage,10); var navBar=""; if(totalPages>nbmaxpages)totalPages=nbmaxpages; if(totalResults>nbimagesperpage){ navBar+="<br>Result page:&nbsp;&nbsp;"; if(firstimage!=0){ navBar+="<span class='spstyle' style='cursor:pointer;' onclick='keywords=\"\";if(firstimage>nbimagesperpage){firstimage-=nbimagesperpage;}else{firstimage=0;}submitForm(firstimage,false);'><strong><font size=3>&laquo; Previous</font></strong></span>";}
if((currentPage+1)<totalPages){ if(firstimage!=0)navBar+="&nbsp;&nbsp;&#149;&nbsp;&nbsp;"; navBar+="<span class='spstyle' style='cursor:pointer;' onclick='keywords=\"\";firstimage+=nbimagesperpage;submitForm(firstimage,false);'><strong><font size=3>Next &raquo;</font></span>";}
navBar+="</center>";}
return(navBar);}
function displayHelp(doc){ document.getElementById("Images").innerHTML=doc;}
function displayWeb(doc){ document.getElementById("Thumbnail").src="http://www.cydral.com/cache.cgi?id="+currentid+"&uploaded=1&d="+(new Date()).getTime();display(doc);}
function display(doc){ document.getElementById("UserMsg").innerHTML=""; if (doc.getElementsByTagName('SPELL_D').item(0)!=null){ spelled=doc.getElementsByTagName('SPELL').item(0).firstChild.nodeValue; document.getElementById("Spell").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#FFFFCC>&nbsp; <img src='http://www.cydral.com/img/info.gif'> Did you mean: <span class='spstyle' style='cursor:pointer;' onclick='TrySpelledForm()'>"+doc.getElementsByTagName('SPELL_D').item(0).firstChild.nodeValue+"</span>?</td></tr></tbody></table>";}else{ document.getElementById("Spell").innerHTML="&nbsp;"; spelled="";}
if(doc.getElementsByTagName('STOP_WORDS').item(0)!=null){ document.getElementById("StopWords").innerHTML="Mots fr&eacute;quents ignor&eacute;s : "+doc.getElementsByTagName('STOP_WORDS').item(0).firstChild.data;}else{ document.getElementById("StopWords").innerHTML="&nbsp;";}
if(doc.getElementsByTagName('STATUS').item(0).firstChild.data!="Ok"||doc.getElementsByTagName('TOTAL_IMG').item(0).firstChild.nodeValue=="0"||doc.getElementsByTagName('COUNT').item(0).firstChild.nodeValue=="0"){ if(uploaded==2){ document.getElementById("Results").innerHTML="No result for this <strong>Web image</strong>";} else if(currentid!=""&&document.search.kwd.value==""){ document.getElementById("Results").innerHTML="No result for this <strong>image</strong>";}else if(currentid!=""&&document.search.kwd.value!=""){ document.getElementById("Results").innerHTML="No result for <strong>"+document.search.kwd.value+"</strong> and this <strong>image</strong>";}else{ document.getElementById("Results").innerHTML="No result for <strong>"+document.search.kwd.value+"</strong>";}
displayErrorMessage(doc.getElementsByTagName('ERROR').item(0).firstChild.data); document.getElementById("Images").innerHTML="&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;<br>&nbsp;";}else{ var endImage=firstimage+parseInt(doc.getElementsByTagName('COUNT').item(0).firstChild.nodeValue); if(document.search.kwd.value!="" && uploaded!=2) document.getElementById("Results").innerHTML="<strong>"+document.search.kwd.value; else document.getElementById("Results").innerHTML="<strong>Visual search"; document.getElementById("Results").innerHTML+="</strong> &nbsp;&middot;&nbsp; Results <strong>"+(firstimage+1)+" - "+endImage+"</strong> of about <strong>"+FormatNumber(doc.getElementsByTagName('TOTAL_IMG').item(0).firstChild.nodeValue)+"</strong> (<strong>"+doc.getElementsByTagName('TIME').item(0).firstChild.nodeValue+"</strong> seconds)"; var time=doc.getElementsByTagName('TIME').item(0).firstChild.nodeValue; var totalImg=doc.getElementsByTagName('TOTAL_IMG').item(0).firstChild.nodeValue; var count=doc.getElementsByTagName('COUNT').item(0).firstChild.nodeValue; var ranks=doc.getElementsByTagName('RANK'); var ids=doc.getElementsByTagName('ID'); var cbirs=doc.getElementsByTagName('CBIR'); var files=doc.getElementsByTagName('FILE'); var contexts=doc.getElementsByTagName('CONTEXT'); var widths=doc.getElementsByTagName('WIDTH'); var heights=doc.getElementsByTagName('HEIGHT'); var sizes=doc.getElementsByTagName('SIZE'); var content="",up="",down="",source,site,ext; for(var cpt=0;cpt<ids.length;cpt++){ if((cpt%5)==0){if(up!=""){content+=up+"</tr>"+down+"</tr></table>";}content+="<br><table border=0 cellspacing=0 cellpadding=5>";up="<tr>";down="<tr>";} rank=parseInt(ranks.item(cpt).firstChild.nodeValue,10); rankimg=(rank<10)?"p0":((rank<20)?"p10":((rank<30)?"p20":((rank<40)?"p30":((rank<50)?"p40":((rank<60)?"p50":((rank<70)?"p60":((rank<80)?"p70":((rank<90)?"p80":((rank<100)?"p90":"p100")))))))));
up+="<td align='center' vAlign='center' width=170 height=150 bgcolor='#FFFDE6'>";if(parseInt(cbirs.item(cpt).firstChild.nodeValue,10)==1){up+="<span style='cursor:pointer;' onclick='sort(\""+ids.item(cpt).firstChild.nodeValue+"\")'>";} up+="<img src='http://www.cydral.com/cache.cgi?id="+ids.item(cpt).firstChild.nodeValue+"'";if(parseInt(cbirs.item(cpt).firstChild.nodeValue,10)==1){up+=" title='Show similar images'";} up+=" border=1>";if(parseInt(cbirs.item(cpt).firstChild.nodeValue,10)==1){up+="</span>";} up+="</td><td width=5>&nbsp;</td>"; source="http://"+files.item(cpt).firstChild.nodeValue; site="http://"+contexts.item(cpt).firstChild.nodeValue; ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase(); if(ext=="jpg")ext="jpeg";else if(ext=="tif")ext="tiff"; down+="<td align='center' valign='top' bgcolor=#fffef2>"; if((standardMode&&currentid!="")||!standardMode){down+="<img src='http://www.cydral.com/img/"+rankimg+".gif' title='Cydral VisualRank'><br>";} down+=ext+" : "+widths.item(cpt).firstChild.nodeValue+" x "+heights.item(cpt).firstChild.nodeValue+" - "+sizes.item(cpt).firstChild.nodeValue+" Kb<br>"; if(parseInt(cbirs.item(cpt).firstChild.nodeValue,10)==1){down+="<span style='cursor:pointer;' onclick='cbir(\""+ids.item(cpt).firstChild.nodeValue+"\")'><img src='http://www.cydral.com/img/cbir.gif' title='Find other similar images'></span>";}else{down+="<span><img src='http://www.cydral.com/img/cbir_d.gif' title='Find other similar images'></span>";} if(document.search.kwd.value!=""&&!isUrlImg(document.search.kwd.value)&&parseInt(cbirs.item(cpt).firstChild.nodeValue,10)==1){down+="<span style='cursor:pointer;' onclick='sort(\""+ids.item(cpt).firstChild.nodeValue+"\")'><img src='http://www.cydral.com/img/sort.gif' title='Sort results by visual similarity'></span>";
}else{down+="<span><img src='http://www.cydral.com/img/sort_d.gif' title='Sort results by visual similarity'></span>";} if(parseInt(cbirs.item(cpt).firstChild.nodeValue,10)==1){down+="<span style='cursor:pointer;' onclick='sortHome(\""+ids.item(cpt).firstChild.nodeValue+"\")'><img src='http://www.cydral.com/img/home.gif' title='Show similar images from this site'></span>";}else{down+="<span><img src='http://www.cydral.com/img/home_d.gif' title='Show similar images from this site'></span>";} down+="&nbsp;&nbsp;&nbsp;&nbsp;<a href='"+site+"' onclick='window.open(\""+site+"\");return false;'><img src='http://www.cydral.com/img/nfs.gif' title='Go to the Web site' border=0></a><a href='"+source+"' onclick='window.open(\""+source+"\");return false;'><img src='http://www.cydral.com/img/inf.gif' title='Show the source image' border=0></a><a href='http://www.cydral.com/cache.cgi?url="+encodeURIComponent(source)+"&id="+ids.item(cpt).firstChild.nodeValue+"'><img src='http://www.cydral.com/img/save.gif' title='Save the image on your drive' border=0></a></td><td>&nbsp;</td>";}
content+=up+"</tr>"+down+"</tr></table>"; content+=displayNavBar(totalImg); document.getElementById("Images").innerHTML=content;}
document.getElementById("SearchInProgress").innerHTML="&nbsp;";document.search.kwd.focus();refreshAds();}
function displayErrorMessage(errorCode){ if(errorCode=="1"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/answer.gif'> <b>No image matched your search.</font></b><p><font size=2>Some suggestions:<br>&nbsp;&nbsp;&nbsp;&#8226; Make sure that all terms are correctly spelled and check the syntax of your request<br>&nbsp;&nbsp;&nbsp;&#8226; Try searching with different keywords<br>&nbsp;&nbsp;&nbsp;&#8226; Try removing some words<br>&nbsp;&nbsp;&nbsp;&#8226; Try entering more general terms<br>&nbsp;&nbsp;&nbsp;&#8226; Try changing or removing some search filters</font></p></td></tr></tbody></table>";}else if(errorCode=="10"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>The request sent to the server is incorrect.</font></b><p><font size=2>Some suggestions:<br>&nbsp;&nbsp;&nbsp;&#8226; Make sure that all terms are correctly spelled and check the syntax of your request<br>&nbsp;&nbsp;&nbsp;&#8226; Try searching with different keywords<br>&nbsp;&nbsp;&nbsp;&#8226; Try removing some words<br>&nbsp;&nbsp;&nbsp;&#8226; Try entering more general terms<br>&nbsp;&nbsp;&nbsp;&#8226; Try changing or removing some search filters</font></p></td></tr></tbody></table>";}else if(errorCode=="20"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>You are not allowed to run this request.</font></b></td></tr></tbody></table>";}else if(errorCode=="30"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>This request can not run because the server is unreachable at present. Please, try again in a few minutes.</font></b></td></tr></tbody></table>";}else if(errorCode=="40"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>Because the Cydral's SafeSearch filtering is activated, the adult-oriented content is filtered out.</font></b></td></tr></tbody></table>";}else if(errorCode=="45"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>The searched image seems to be an offensive content. Because the Cydral's SafeSearch filtering is activated, the adult-oriented content is filtered out.</font></b></td></tr></tbody></table>";}else if(errorCode=="50"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>The searched image can not be retrieved in the cache system.</font></b></td></tr></tbody></table>";}else if(errorCode=="55"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>The searched image is not yet available, you have to send again this image to the server before to start a new search.</font></b></td></tr></tbody></table>";}else if(errorCode=="60"){document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>The Web searched image is no more available or can not be reached by the server.</font></b></td></tr></tbody></table>";}else if(errorCode=="65"){document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>The searched element is not an image or can not be analysed by the server.</font></b></td></tr></tbody></table>";}else if(errorCode=="70"){document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>The searched image is too small to be analysed by the server. Cydral prefers images that are at least 80 pixels in either dimension.</font></b></td></tr></tbody></table>";}else if(errorCode=="80"){document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>The searched image contains few visual informations to efficiently match other pictures.</font></b></td></tr></tbody></table>";}else if(errorCode=="255"){ document.getElementById("UserMsg").innerHTML="<br><table style='BORDER:#EFEBEF 1px solid;' cellspacing=0 cellpadding=5 width=100%><tbody><tr><td align=left bgcolor=#E7FBFF><font size=2><img src='http://www.cydral.com/img/wr.gif'> <b>An error occured while running your search. Please, try again in a few minutes.</font></b></td></tr></tbody></table>";}else{ document.getElementById("UserMsg").innerHTML="";}}
function startCallback(){ var source=document.search.pic.value; var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase(); for(var i=0;i<fileTypes.length;i++)if(fileTypes[i]==ext)break;if(i>=fileTypes.length){alert("This file is an unknown filetetype.\nThe supported filetypes are:\n\n"+fileTypes.join(", "));resetImage();return false;}else{uploaded=1;currentid=clientid;document.search.postedid.value=currentid;document.getElementById("SearchInProgress").innerHTML="<img src='http://www.cydral.com/img/pg.gif'/><strong>&nbsp;&nbsp;Sending image to the server...</strong>";return true;}}
function completeCallback(response){ keywords="";document.search.kwd.value="";document.search.reset();document.getElementById("Thumbnail").src="http://www.cydral.com/cache.cgi?id="+currentid+"&uploaded=1&d="+(new Date()).getTime();submitForm(0,false);}
AIM={frame:function(c){ var n='f'+Math.floor(Math.random()*99999); var d=document.createElement('DIV'); d.innerHTML='<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>'; document.body.appendChild(d); var i=document.getElementById(n); if(c&&typeof(c.onComplete)=='function'){i.onComplete=c.onComplete;}
return n;}, form:function(f,name){f.setAttribute('target',name);}, submit:function(f,c){ AIM.form(f,AIM.frame(c)); if (c&&typeof(c.onStart)=='function'){return c.onStart();} else {return true;}
}, loaded:function(id){ var i=document.getElementById(id); var d; if(i.contentDocument){d=i.contentDocument;} else if(i.contentWindow){d=i.contentWindow.document;} else {d=window.frames[id].document;} if(d.location.href=="about:blank"){return;} if(typeof(i.onComplete)=='function'){i.onComplete(d.innerHTML);}}}
function isUrlImg(s){var regexp=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; return regexp.test(s);}
function refreshAds(){ var d=document.getElementById('Banner');callads++;if(d&&(callads<20)){var s=d.getElementsByTagName('iframe');if(s&&s.length){s[0].src=s[0].src+'&'+new Date().getTime();}}return true;}
function setStandardMode(){currentid="";standardMode=true;document.getElementById('standardmode').innerHTML="<strong>Web Images</strong>";document.getElementById('reversemode').innerHTML="<span style='cursor:pointer;' onclick='setReverseMode()'><font color='#909'><u>Reverse Search</u></font><sup><font color='#FF0000'>beta</font></sup></span>";document.getElementById('kwdlabel').innerHTML="<font face='Arial' size='-1' color='#888888'>Enter image keywords</font>&nbsp;";document.getElementById('piclabel').style.visibility="hidden";keywords="";document.search.kwd.value="";document.location.hash=" ";resetFields(true);document.search.kwd.focus();}
function setReverseMode(){currentid="";standardMode=false;document.getElementById('standardmode').innerHTML="<span style='cursor:pointer;' onclick='setStandardMode()'><font color='#909'><u>Web Images</u></font></span>";document.getElementById('reversemode').innerHTML="<strong>Reverse Search</strong><sup><font color='#FF0000'>beta</font></sup>";document.getElementById('kwdlabel').innerHTML="<font face='Arial' size='-1' color='#888888'>Enter or paste image URL</font>&nbsp;";document.getElementById('piclabel').style.visibility="visible";keywords="";document.search.kwd.value="";document.location.hash=" ";resetFields(true);document.search.kwd.focus();}