var faqHead=new Array('What is SMS Search','How to search?','Want More Results?','What can I search for?','Search Tips','Examples');
var faqContent=new Array();
faqContent[0]='<p class="f11p"><font size="5">What is SMS Search</font></p><p><font size=2>SMS Search : As simple as sending a sms to 53456 , to find your favourite restaurants, bars, movies, atms etc <a href="javascript:_initFaq(3);"> see all </a></font></p><p><font size="2">Your cellphone is now your guide to <b>Delhi, Mumbai, Bangalore, Chennai, Kolkata and Pune</b>.</font></p><p><font size="2">Continuing with our goal to provide users easy access to the information around them, we bring the power of local search to&nbsp;mobile phones. With Onyomo SMS Search your cellphone can help you find local information where ever you may be in <b>Delhi/NCR, Mumbai, Bangalore, Chennai</b> (more cities to come soon). It is as simple as sending a SMS!</font></p><p><font size=2>Next: <a href="javascript:_initFaq(1);"> How to search </a></font></p>';
faqContent[1]='<p><font size="5">How to search?</font></p><p><font size="2">Send a sms to <b>53456</b> with what you are looking for and optionally the preferred location with <b>FIND</b> keyword.</font></p>Just send <b>\"FIND &lt;keyword&gt; &lt;location&gt;\"</b> to <b>53456</b><font></p><p><font size=2>e.g:  <a href="javascript:submitInp(1,\'FIND icici atm noida\');" title="Click to see results in demo mobile screen!">FIND icici atm noida</a> -- to find icici atms in and around noida<br> e.g:  <a href="javascript:submitInp(1,\'FIND movies saket\');" title="Click to see results in demo mobile screen!">FIND movies saket</a> -- to find movies playing in and around saket<br> e.g:  <a href="javascript:submitInp(1,\'FIND bar andheri\');" title="Click to see results in demo mobile screen!">FIND bars andheri</a> -- to find bars in and around andheri</font></p><p><font size=2>You can also search without specifying any location<br>e.g:  <a href="javascript:submitInp(1,\'FIND movie casino royale\');" title="Click to see results in demo mobile screen!">FIND movie casino royale</a> -- to find all places and show-timings for "casino royale"<br>e.g: <a href="javascript:submitInp(1,\'FIND bar elevate\');" title="Click to see results in demo mobile screen!">FIND bar elevate</a> - to find details of Elevate bar<br>e.g: <a href="javascript:submitInp(1,\'FIND 5 star hotels\');" title="Click to see results in demo mobile screen!">FIND 5 star hotels</a></font></p><p><font size=2>Note: By  default we guess the city of your search using your phone-number :-), but you can always search for all other cities by including say \"blr\", \'del\', \'mum\' in your message to change the default city.</font></p><p><font size=2>For example if you are in Bangalore and want to search something in Mumbai, send:<br>eg: FIND goan food mum -- to find places in mumbai that serve Goan food !</font></p><p><font size=2>From now on your default city would be Mumbai, you can ofcourse always switch back to your or any other city by including <b>del</b> or <b>blr</b> or <b>mum</b> !</font></p><p><font size=2>Next: <a href="javascript:_initFaq(5);"> More Examples</a></font></p>';
faqContent[2]='<p><font size="5">Want More Results?</font></p><p><font size="2">It is as simple as just sending "<b>FIND next</b>" to <b>53456</b> , and we will give you next set of results for your last search, ofcourse if any !</font></p>';
faqContent[3]='<p><font size="5">What can I search for?</font></p><p><font size="2">As of now you can search for following, though we assure you that we are burning mid-night oil to have more cities and more subcategories.<ol><li>Restaurants (All)</li><li>Cinemas (All)</li><li>Lounges and Bars (All)</li><li>Hotels (Lodging) (All)</li><li>Coffee Shops (Delhi, Bangalore)</li><li>Book Stores (Delhi, Bangalore)</li><li>Florists (All)</li><li>ATMs (All)</li><li>Taxi Services (Delhi)</li><li>Courier Services (Delhi)</li><li>Cyber Cafe (Delhi)</li><li>Beauty Saloons (Delhi)</li><li>Driving Schools (Delhi)</li><li>Gymnasiums (Delhi)</li><li>Chemists (Delhi)</li><li>Hospitals (Delhi, Mumbai)</li><li>Electronics (All)</li></ol></font></p>';
faqContent[4]='<p><font size="5">Search Tips</font></p><font size="2"><p>If you know the name of say Movie, Restaurant, Theater, Book Store, Florist, Taxi service etc. just send the name (optionally add location) with <b>FIND</b> to 53456.</p><p>For example if you want to find the Teksons BookShop</p><p></p><ul><li><b>Without location: </b>SMS <b>FIND teksons</b> to <b>53456</b></li><li><b>With location: </b>SMS <b>FIND teksons noida</b> to <b>53456</b> to find Teksons in Noida.</li></ul><p></p><p>Though you can search without specifying a location, giving a location would help us in giving a better and more useful result.</p><p>If you are not able to find something try to use some alternative words.</p><p>If your first result is not what you are looking for, please send <b>FIND next</b> to <b>53456</b> for next result.</p><p>For help and examples you can SMS <b>FIND help</b> to <b>53456</b></p><br><p><b>Note:</b><br></p><ol><li>All SMS sent to <b>53456</b> are charged at premium rates. For details please contact your service provider.	</li><li>Congestion on the network could lead to a slight delay in response. This has been seen on Hutch.</li><li>We try our best to serve the most approriate results for your query. As this service is still in a testing phase, there can be cases that we are not able to get %27best%27 result, please bear with us. :-) </li><li>We will never use your phone number for <i>spamming</i>.</li><li>We would love to hear from you about this service. Your feedback is invaluable for us. <a class="f100r" href="javascript:feedback();">Click</a> to send us a feedback.</li><li>This Help/FAQ page has been put in a great hurry, please tolerate for insufficient information (and spelling/grammatical mistakes ;-) ), we will soon improve it .... </li></ol><p></p></font>';
faqContent[5]='<p><font size=2><b>Examples</b>: You can possibly search in any way you want to at onyomo, you dont need to remember different keywords for different categories etc. The follwing examples are just one of the many ways in which you can search !</font></p><p><font size=2>Just send \"<b>FIND</b> <b>&lt;what-you-are-looking-for&gt;</b> <b>&lt;where-you-are-looking-for&gt;</b>\" to <b>53456</b></font></p><p><font size=2>Note: In every search you can optionally add location to get more specific results</font></p><p><font size=2><b>Restaurants</b>: You can search by name of a restaurant, by cuisine etc etc<br>ex: \'<a href="javascript:submitInp(1,\'FIND mcdonalds\');" title="Click to see results in demo mobile screen!">FIND mcdonalds</a>\'<br>ex: \'<a href="javascript:submitInp(1,\'FIND italian gk\');" title="Click to see results in demo mobile screen!">FIND italian gk</a>\' -- find italian restaurants in/around Greater Kailash</font></p><p><font size=2><b>Cinemas</b>: You can search by movie name, theatre name, movies genre or movies playing in a location etc etc<br>ex: \'<a href="javascript:submitInp(1,\'FIND comedy cp\');" title="Click to see results in demo mobile screen!">FIND comedy cp</a>\' -- to find comedy movies playing in/around Connaught Place!<br>ex: \'<a href="javascript:submitInp(1,\'FIND movies saket\');" title="Click to see results in demo mobile screen!">FIND movies saket</a>\' -- to find movies playing in locality saket</font></p><p><font size=2><b>Lounges and Bars</b>: Search using name, location, cuisine etc<br>ex: FIND bar dance gurgaon -- to find bars with dance floor in gurgaon</font></p><p><font size=2><b>Coffee Shops</b>: \'<a href="javascript:submitInp(1,\'FIND barista juhu\');" title="Click to see results in demo mobile screen!">FIND barista juhu</a>\' or \'<a href="javascript:submitInp(1,\'FIND coffee wifi\');" title="Click to see results in demo mobile screen!">FIND coffee wifi</a>\'</font></p><p><font size=2><b>ATMs</b> : \'<a href="javascript:submitInp(1,\'FIND icici atm andheri\');" title="Click to see results in demo mobile screen!">FIND icici atm andheri</a>\'</font></p><p><font size=2><b>Hotels (Lodging)</b>: \'<a href="javascript:submitInp(1,\'FIND 5 star hotel cp\');" title="Click to see results in demo mobile screen!">FIND 5 star hotel cp</a>\'</font></p><p><font size=2>Similarly you can search in following categories '/*(Available for Delhi only)*/+'<br><b>Florists<br>Taxi Services<br>Courier Services<br>Book Stores<br>Cyber Cafe<br>Beauty Saloons<br>Driving Schools<br>Gymnasiums<br>Chemists<br>Hospitals</b></font></p><p><font size=2>Note: for emergency services like <b>Chemist</b>, <b>Hospitals</b> etc please call to confirm.</font></p><p><font size=2></font></p>';
//Finds the absolute X position (integer value) of a object on screen. The agrgument to be passed is elements id.
//This function is absolutely independent of the style.position attribute of the element.
function fXPos(element){try{var obj=o(element);var curleft = 0;if (obj.offsetParent){
while (obj.offsetParent){curleft += obj.offsetLeft;obj = obj.offsetParent;}}else if (obj.x)curleft += obj.x;
return curleft;}catch(e){}}

//Finds the absolute Y position (integer value) of a object on screen. The agrgument to be passed is elements id.
//This function is absolutely independent of the style.position attribute of the element.
function o(id){return document.getElementById(id);}
function fYPos(element){try{var obj=o(element);var curtop = 0;if (obj.offsetParent){
while (obj.offsetParent){curtop += obj.offsetTop;obj = obj.offsetParent;}}else if (obj.y)curtop += obj.y;
return curtop;}catch(e){}}

//SMS search
var req,smsCircle='Delhi';
var userSMS='demo';

/*if(document.URL.match("www."))
        var strURLPrefix= "http://www.onyomo.com/";
else
        var strURLPrefix= "http://onyomo.com/";*/


var strURLPrefix = "../";

function _changeCircle(val){smsCircle=val;}
			
            function submitInp(id,str){
				if(id==0){
				s = document.getElementById('inp').value
				if ((s == 'Enter search here. Try    \'FIND cinema Saket\'')||(s=="")){
					alert("Please enter your search text!")
					return
				}}
				else s=str;
				getbotResponse(user, s)
			}

			//Changed by Shalin to accomodate browser differences wrt XMLHttpRequest on 24-11-2006
			function getbotResponse(user, s){
				//req = new XMLHttpRequest();
				if(window.XMLHttpRequest)
					req = new XMLHttpRequest();
				else if(window.ActiveXObject) {                                 // branch for IE/Windows ActiveX version
					try {
						req = new ActiveXObject("Msxml2.XMLHTTP");
					} catch(e) {
						try {
							req = new ActiveXObject("Microsoft.XMLHTTP");
						} catch(e) {
							req = false;
						}
					}
				}

				s = replace(s, " ", "+")
				url = strURLPrefix + "chat.html?num="+userSMS+"&mess="+s+'&Circle='+smsCircle;
                		req.onreadystatechange = appendResponse;
		                req.open("GET", url, true);
                		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		                req.send("");
        		}
			function appendResponse(response){
				if (req.readyState == 4){
					if (req.status == 200) {
                                	var response = req.responseText
					response = replace(response, '+', ' ')
					response = replace(response, '\n', '')
					document.getElementById('inp').value =unescape(response)
					}
				}
			}
			function replace(str,text,by){var strLength = str.length, txtLength = text.length;
				if ((strLength == 0) || (txtLength == 0)) return str;var i = str.indexOf(text);
				if ((!i) && (text != str.substring(0,txtLength))) return str;if (i == -1) return str;
				var newstr = str.substring(0,i) + by;if (i+txtLength < strLength)
				newstr += replace(str.substring(i+txtLength,strLength),text,by);return newstr;}
			function clearA(){
					document.getElementById('chat').innerHTML =''
			}
///////////

function _initSMS(){
	_initFaq(0);
	_initOS();
}
function _initFaq(id){
	var head='',bg;
        for(var i=0;i<faqHead.length;i++){bg='#ffffff';if(i==id)bg='#f4f4f4';head+='<div id="head_'+i+'" style="cursor:pointer;color:#2D64A8;background:'+bg+'"><a href="javascript:_initFaq('+i+')">'+faqHead[i]+'</a></div>'}
        document.getElementById('faqHead').innerHTML=head;
	document.getElementById('faqContent').innerHTML=unescape(faqContent[id]);
}

function clearField()	{
	document.getElementById("inp").value = 'Enter search here. Try    \'FIND cinema Saket\'';
}

function _initOS(){
	var sI=document.createElement("div");
	sI.id="sII";
	sI.style.position="absolute";
	sI.style.top=fYPos('sMain')+35;
	sI.style.left=fXPos('sMain')+10;
	sI.style.width=111;
	sI.style.height=148;
	sI.style.background="#ffffff";
	sI.style.zIndex=1000;
	sI.style.border="1px solid gray";
	document.getElementById('sMain').appendChild(sI);
	
	var con='<table width="111" cellpadding=0 cellspacing=0 border=0>';
	con+='<tr><td class="text" style="border-bottom:1px solid gray;" height=14><span id="textHead"><font size=1>&nbsp;To: 53456</font></span></td></tr>';
	con+='<tr><td class=text valign=top><textarea id="inp" name="inp" style="overflow:hidden;width:111px;height:115px;border:none;background:#2D64A8;color:white;" onfocus="sFocus();">Enter search here. Try    \'FIND cinema Saket\'</textarea></td></tr>';
	con+='<tr><td class=text align=center><table width="100%" cellpadding=0 cellspacing=0 border=0><tr><td align=left valign=bottom><span id="button_new"><input type=button onclick="javascript:clearField();" size=100 name=enter style="border:1px solid gray;font-size:10px;background:#ffffff;color:Blue;cursor:pointer;" value=New></span></td><td align=right valign=bottom><span id="button_send"><input type=button name=enter style="border:1px solid gray;font-size:10px;background:#ffffff;color:Blue;cursor:pointer;" onclick="javascript:submitInp(0,\'\')" value=Send></span></td></tr></table></td></tr>';
	con+='</table>';
	o('sII').innerHTML=con;
	var sF=document.createElement("div");
        sF.id="sF";
        sF.style.position="absolute";
	sF.style.filter="alpha(opacity=60)";
	sF.style.opacity="0.6";
        sF.style.top=fYPos('sMain')+220;
        sF.style.left=fXPos('sMain')+10;
        sF.style.width=111;
        sF.style.height=148;
        sF.style.background="#ffffff";
        sF.style.zIndex=1000;
        sF.style.border="1px solid gray";
        document.getElementById('sMain').appendChild(sF);
	sF.innerHTML='<table width=100% height=100% cellpadding=0 cellspacing=0 border=0><tr><td valign=top align=center><font color="#f68908"><b>Try it out!</b></font><br><font size=2>Type a search term on the screen</font><hr><font class=text>Send <b>FIND</b> <b>&lt;keyword&gt;</b> <b>&lt;location&gt;</b> to <b>53456</b></font></td></td></table>';
}
function newSearch(){_initOS();}
function sFocus(){if(o('inp').value=='Enter search here. Try    \'FIND cinema Saket\'')o('inp').value='';}
