//tip
(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,e=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];e+=a.outerWidth()+c.offset[1];var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")e-=a/2;if(i=="left")e-=a;return{top:h,left:e}}function t(a,b){var c=this,h=a.add(c),e,i=0,j=0,m=a.attr("title"),q=n[b.effect],k,r=a.is(":input"),u=r&&a.is(":checkbox, :radio, select, :button"),
s=a.attr("type"),l=b.events[s]||b.events[r?u?"widget":"input":"def"];if(!q)throw'Nonexistent effect "'+b.effect+'"';l=l.split(/,\s*/);if(l.length!=2)throw"Tooltip: bad events configuration for "+s;a.bind(l[0],function(d){if(b.predelay){clearTimeout(i);j=setTimeout(function(){c.show(d)},b.predelay)}else c.show(d)}).bind(l[1],function(d){if(b.delay){clearTimeout(j);i=setTimeout(function(){c.hide(d)},b.delay)}else c.hide(d)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,
{show:function(d){if(!e){if(m)e=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else if(b.tip)e=f(b.tip).eq(0);else{e=a.next();e.length||(e=a.parent().next())}if(!e.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;e.stop(true,true);var g=p(a,e,b);d=d||f.Event();d.type="onBeforeShow";h.trigger(d,[g]);if(d.isDefaultPrevented())return c;g=p(a,e,b);e.css({position:"absolute",top:g.top,left:g.left});k=true;q[0].call(c,function(){d.type="onShow";k="full";h.trigger(d)});
g=b.events.tooltip.split(/,\s*/);e.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&e.bind(g[1],function(o){o.relatedTarget!=a[0]&&a.trigger(l[1].split(" ")[0])});return c},hide:function(d){if(!e||!c.isShown())return c;d=d||f.Event();d.type="onBeforeHide";h.trigger(d);if(!d.isDefaultPrevented()){k=false;n[b.effect][1].call(c,function(){d.type="onHide";k=false;h.trigger(d)});return c}},isShown:function(d){return d?k=="full":k},getConf:function(){return b},
getTip:function(){return e},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(d,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(o){f(c).bind(g,o);return c}})}f.tools=f.tools||{version:"1.2.2"};f.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",
tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){n[a]=[b,c]}};var n={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,
{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new t(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
(function(g){function j(a){var c=g(window),d=c.width()+c.scrollLeft(),h=c.height()+c.scrollTop();return[a.offset().top<=c.scrollTop(),d<=a.offset().left+a.width(),h<=a.offset().top+a.height(),c.scrollLeft()>=a.offset().left]}function k(a){for(var c=a.length;c--;)if(a[c])return false;return true}var i=g.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};g.fn.dynamic=function(a){if(typeof a=="number")a={speed:a};a=g.extend({},i.dynamic.conf,a);var c=a.classNames.split(/\s/),d;this.each(function(){var h=
g(this).tooltip().onBeforeShow(function(e,f){e=this.getTip();var b=this.getConf();d||(d=[b.position[0],b.position[1],b.offset[0],b.offset[1],g.extend({},b)]);g.extend(b,d[4]);b.position=[d[0],d[1]];b.offset=[d[2],d[3]];e.css({visibility:"hidden",position:"absolute",top:f.top,left:f.left}).show();f=j(e);if(!k(f)){if(f[2]){g.extend(b,a.top);b.position[0]="top";e.addClass(c[0])}if(f[3]){g.extend(b,a.right);b.position[1]="right";e.addClass(c[1])}if(f[0]){g.extend(b,a.bottom);b.position[0]="bottom";e.addClass(c[2])}if(f[1]){g.extend(b,
a.left);b.position[1]="left";e.addClass(c[3])}if(f[0]||f[2])b.offset[0]*=-1;if(f[1]||f[3])b.offset[1]*=-1}e.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var e=this.getConf();this.getTip();setTimeout(function(){e.position=[d[0],d[1]];e.offset=[d[2],d[3]]},0)});h.onHide(function(){var e=this.getTip();e.removeClass(a.classNames)});ret=h});return a.api?ret:this}})(jQuery);

document.write('<div name="tips"><div id="tscreenTIP" class="tip">Touchscreens allow a user to interact directly with the phone\'s display by touching it.<p>Resistive touchscreens are commonly found in mid end touchscreen phones, and responds to taps (presses) on the screen.</p><p>Capacitive touchscreens are generally found in high end phones and respond even to very light touches, and thus create a smoother user experience. They also generally support multi-touch gestures such as pinch-to-zoom, unlike resistive screens.</p></div><div id="keyboardTIP" class="tip">Phones with a full keyboard allow for much faster typing and can be especially useful if you use your phone for sending large SMSes and E-Mails.</div><div id="msensorTIP" class="tip">Phones equipped with a motion sensor can detect motion and orientation, allowing for automatic switching of display between portrait and landscape, as well as allowing you to play various motion based games.</div><div id="internetTIP" class="tip">Phones with basic internet (GPRS/EDGE) support allow internet access (at low to medium speeds) for checking mail, social networking, downloading content etc.</div><div id="3gTIP" class="tip">3G phones allow for high speed (broadband) internet access and video streaming on supported networks.</div><div id="wifiTIP" class="tip">WiFi compatible phones allow you to access high speed WiFi internet networks at home, at airports and at cafes.</div><div id="usbTIP" class="tip">A USB Connection allows you to connect your phone to your PC through a USB Cable for transfer of music, pictures and applications.</div><div id="btoothTIP" class="tip">Bluetooth is used for wireless transfer of music, pictures, videos and applications between any 2 Bluetooth enabled devices (mobile phones, laptops, MP3 players etc).<p>Bluetooth mobile phones can also be used along with Bluetooth headphones for listening to music and taking calls wirelessly.</p></div><div id="radioTIP" class="tip">FM Radio phones can access the local FM networks to provide round the clock music and entertainment options.</div><div id="fmrecTIP" class="tip">This handy feature allows you to record music clips from live radio stations and store them in your phone.</div><div id="inradioTIP" class="tip">An internal FM antenna embedded in the phone\'s body (as opposed to the headset) enables you to listen to FM Radio on the loudspeaker of your phone, even if the headset is not connected.</div><div id="mp3TIP" class="tip">Music phones offer a convenient replacement for MP3 players, allowing you to carry one device instead of two.</div><div id="rtransmitTIP" class="tip">An FM transmitter allows your phone to broadcast its MP3 song library to nearby FM radios at a set frequency. This can be used, for example, to listen to your phone playlist on your car stereo!</div><div id="stereoTIP" class="tip">Phones with stereo loudspeakers (separate speakers for the left and right sound channels) instead of mono speakers, are able to produce higher quality and louder music through their loudspeakers.</div><div id="camTIP" class="tip">The resolution of the camera (in mega-pixels) defines the level of detail of the pictures that you can take with it.<p>A higher megapixel rating generally (but not always) indicates better picture quality.</p></div><div id="flashlightTIP" class="tip">A handy feature that allows you to use your phone as a flashlight (torch) when in dark.</div><div id="javaTIP" class="tip">Java Support allows you to install a variety of Java based applications on your phone such as dictionaries, games, internet browsers etc.</div><div id="voiceTIP" class="tip">Voice Recording lets you record and store short voice messages in your phone. Some phones with this feature also let you record parts of phone conversation in progress</p></div><div id="vdialTIP" class="tip">Voice Commands allow you to operate your phone (dial numbers and/or use features such as search/music/maps etc) using your voice.</div><div id="gpsTIP" class="tip">GPS Mobiles allow you to track your exact location on a map with the help of satellite signals, thus helping you navigate.</div><div id="docTIP" class="tip">A document viewer allows you to view various Office files such as Word docs, Presentations, Spreadsheets and PDFs on your mobile phone.</div><div id="simsTIP" class="tip">A dual/triple sim mobile has active slots for multiple sim cards, all of which can be used for making and receiving calls.</div><div id="memoryTIP" class="tip">Phone memory is used to store music, pictures, videos and applications.<p>To use a phone as a music/video player, make sure it has at least 1 GB of internal memory, or alternatively, support addition of memory cards through external slots.</p><p>1 GB of memory can store around 200 songs.</p></div><div id="priceTIP" class="tip">Current Market Price for this phone. Prices are fetched from our retail partners across India.</div><div id="cpuramTIP" class="tip">Processor speed and RAM are indicative of the speed of a phone, and its ability to handle multiple open applications simultaneously.</div><div id="launchTIP" class="tip">Launch date in India. Newly launched phones tend to have better technologies and pack a better set of features for lower prices.</div><div id="batchargeTIP" class="tip">Estimate of the phone\'s charging frequency with moderate use. <p>Derived from user experience and/or calculations based on battery talktime and general usage profile of the phone.</p></div><div id="talktimeTIP" class="tip">Battery Talktime is the maximum time that a fully charged phone battery lasts, under ideal conditions, when the phone is continuously on a call. Figures quoted are official figures, released by the manufacturers. <p>Since battery life measurement methods may vary significantly between  manufacturers, these numbers are most effective when comparing phones from the same manufacturer.</p></div><div id="standbyTIP" class="tip">Battery Standby is the maximum time that a fully charged phone battery lasts, under ideal conditions, when the phone is constantly connected to a network, but is not in active use. Figures quoted are official figures, released by the manufacturers. <p>Since battery life measurement methods may vary significantly between  manufacturers, these numbers are most effective when comparing phones from the same manufacturer.</p></div><div id="mahTIP" class="tip">How much electrical charge a particular battery will hold, when fully charged. <p>How much a phone battery lasts in actual use will also depend on how much battery is used by the phone in a typical use case.</p><p>More advanced phones (bigger screens, bigger CPU etc) will generally consume more battery per unit time, compared to more simple phones. Hence, battery capacity is of use only when comparing phones with similar hardware and software.</p></div><div id="thicknessTIP" class="tip">Thickness of the phone in mm. A slim phone is generally easier to carry around in your pocket.</div><div id="dsize3TIP" class="tip">Diagonal screen size. Large screen sizes are best suited for multimedia and web browsing.</div><div id="contactsTIP" class="tip">Number of contacts that can be stored in phone memory.</div><div id="smsTIP" class="tip">Number of SMSes that can be stored in phone memory.</div><div id="linkTIP" class="tip">Link to the official website of the phone.</div><div id="ereviewsTIP" class="tip">Best reviews for this phone, from across the web.</div><div id="amoledTIP" class="tip">AMOLED screens are more vivid, high contrast and life-like, compared to normal LCD screens.</div><div id="sjackTIP" class="tip">Phones with standard (3.5 mm) headphone jacks give you an important advantage - if your phone\'s original headphones stop working, you will be able to use any standard headphones in their place (you are not tied to buying headphones only from the original manufacturer)</div><div id="scamTIP" class="tip">An additional camera [apart from the main one], located on the front of the phone, allows you to easily take self portraits, as well as make video calls [on 3G or WiFi networks]</div><div id="osTIP" class="tip">Smartphones are based on advanced operating systems such as Android, Symbian, Windows Phone, Blackberry or iPhone OS.<p>These phones function like mini PCs and have excellent email handling capabilities, organiser functions, and large amount of extensibility through installable applications.</p><p><a href="http://www.phonecurry.com/knowledge-series/smartphone-comparison/" target="_blank">Smartphone OS Comparison &gt;&gt;</a></p></div><div id="androidTIP" class="tip">Google\'s Smartphone OS, featuring a simple, intuitive interface, and deep integration with Google services like Gmail, Contacts, Calendar, and YouTube.<p><a href="http://www.phonecurry.com/knowledge-series/google-android/" target="_blank">More About Google Android &gt;&gt;</a></p></div><div id="otrackTIP" class="tip">An optical trackpad is an advanced navigation tool, generally found on high end phones, that captures movement (of a thumb or a finger) across its surface and translates it into direction for a cursor or an \'item highlight\' on screen.</div><div id="tballTIP" class="tip">A navigation tool consisting of a rotatable ball in a small housing that captures movement (of a thumb or a finger) across its surface and translates it into direction for a cursor or an \'item highlight\' on screen</div><div id="crystalTIP" class="tip">Noise filtration technologies allow the phone to filter out constant background noise during conversations, thus allowing the person at the other end to hear you clearly even when you are in a noisy environment.</div><div id="compassTIP" class="tip">A built-in digital compass rotates GPS maps to always match the direction you are facing, making navigation using the phone more convenient.</div><div id="tvoutTIP" class="tip">A TV Out Cable allows you to connect your phone to a TV and view images and videos stored on it directly onto your TV.</div><div id="snetTIP" class="tip">Social networking applications allow you to access various social services such as Facebook and Twitter on your phone.</div><div id="freememTIP" class="tip">A free memory card that comes bundled with your phone can be used to store your music, picture and video libraries for access on the phone.</div><div id="weightTIP" class="tip">Weight of the phone in grams. Lighter phones are easier to carry around.</div><div id="resolutionTIP" class="tip">Screen resolution in pixels. High resolution screens have a sharper and more finely detailed display.</div><div id="ratingTIP" class="tip">Our overall rating of the phone. Takes into account phone price, feature set, and opinion from expert reviews.<p>Phones with ratings of 3.5 and above, are classified as "Recommended Buys".</p></div><div id="prosTIP" class="tip">Average opinion around the phone, based on various expert reviews.</div><div id="mslotTIP" class="tip">Phones with external memory slots allow expansion of the phone\'s memory by adding a memory card.</div><div id="youtubeTIP" class="tip">Search for and watch YouTube videos on your phone.</div><div id="imTIP" class="tip">Instant messaging applications such as Google Talk, MSN Messenger and Yahoo Messenger allow you to chat with your friends on your phone.</div><div id="emailTIP" class="tip">Email applications access your Gmail, Yahoo, Hotmail and other emails accounts, and keep you notified about new mails.</div><div id="coversTIP" class="tip">Phones with exchangeable covers are designed to let the user remove the front and/or back covers and replace them with others, to change the color, and styling of the phone.</div><div id="hinglishTIP" class="tip">A Hinglish T9 dictionary additionally consists of Hindi spoken words (think "kya","kyun","aaj", etc) apart from English words, thus allowing for faster text entry in Hinglish.<p>A T9 dictionary, which is a part of almost all modern day phones, allows words to be entered by a single keypress for each letter (by using predictive technology), as opposed to the multi-tap approach normally used in mobile phones in which several letters are associated with each phone key.</p></div><div id="noteTIP" class="tip">Other important features.</div><div id="completeListTIP" class="tip">This list includes only :<ol><li>Phones currently available in India (not discontinued)</li><li>GSM Phones (not CDMA)</li></ol></div><div id="dlnaTIP" class="tip">DLNA (Digital Living Network Alliance) support allows your phone to stream photos, music and videos to other DLNA compatible devices (like TVs) wirelessly.</div><div id="hdmiTIP" class="tip">HDMI (High-Definition Multimedia Interface) support allows your phone to stream HD photos and videos to other HD devices (like TVs) through an HDMI cable.</div><div id="mhlTIP" class="tip">Mobile High-Definition Link (MHL) is a mobile audio/video interface that allows connecting mobile phones to high-definition televisions (HDTVs) and displays, for streaming HD photos/videos etc.<p>As opposed to a standard HDMI cable which requires a separate port on the mobile device, a MHL link usually works over the standard USB port, and even allows charging of the mobile device while it\'s connected.</p></div><div id="tetheringTIP" class="tip">WiFi Tethering allows your phone to share its GPRS/EDGE/3G internet connection with another device (like a laptop) over WiFi.</div><div id="nfcTIP" class="tip">NFC (Near field communication) support allows your phone to exchange data, or transact with a compatible NFC device, simply by touching against it. This translates into many potential applications including file sharing, electronic money transactions, storage/exchange of coupons, tickets, keys, identity data etc.</div></div>');


$(document).ready(function() { 
    $(".sims").tooltip({tip:'div#simsTIP'}).dynamic();
    $(".flashlight").tooltip({tip:'div#flashlightTIP'}).dynamic();
    $(".voice").tooltip({tip:'div#voiceTIP'}).dynamic();
	$(".tscreen").tooltip({tip:'div#tscreenTIP'}).dynamic();
	$(".keyboard").tooltip({tip:'div#keyboardTIP'}).dynamic();
	$(".msensor").tooltip({tip:'div#msensorTIP'}).dynamic();
	$(".internet").tooltip({tip:'div#internetTIP'}).dynamic();
	$(".3g").tooltip({tip:'div#3gTIP'}).dynamic();
	$(".wifi").tooltip({tip:'div#wifiTIP'}).dynamic();
	$(".usb").tooltip({tip:'div#usbTIP'}).dynamic();
	$(".btooth").tooltip({tip:'div#btoothTIP'}).dynamic();
	$(".radio").tooltip({tip:'div#radioTIP'}).dynamic();
	$(".fmrec").tooltip({tip:'div#fmrecTIP'}).dynamic();
	$(".inradio").tooltip({tip:'div#inradioTIP'}).dynamic();
	$(".mp3").tooltip({tip:'div#mp3TIP'}).dynamic();
	$(".rtransmit").tooltip({tip:'div#rtransmitTIP'}).dynamic();
	$(".stereo").tooltip({tip:'div#stereoTIP'}).dynamic();
	$(".cam").tooltip({tip:'div#camTIP'}).dynamic();
	$(".java").tooltip({tip:'div#javaTIP'}).dynamic();
	$(".vdial").tooltip({tip:'div#vdialTIP'}).dynamic();
	$(".gps").tooltip({tip:'div#gpsTIP'}).dynamic();
	$(".doc").tooltip({tip:'div#docTIP'}).dynamic();
	$(".memory").tooltip({tip:'div#memoryTIP'}).dynamic();
	$(".price").tooltip({tip:'div#priceTIP'}).dynamic();
	$(".launch").tooltip({tip:'div#launchTIP'}).dynamic();
	$(".batcharge").tooltip({tip:'div#batchargeTIP'}).dynamic();
	$(".talktime").tooltip({tip:'div#talktimeTIP'}).dynamic();
	$(".standby").tooltip({tip:'div#standbyTIP'}).dynamic();
	$(".mah").tooltip({tip:'div#mahTIP'}).dynamic();
	$(".thickness").tooltip({tip:'div#thicknessTIP'}).dynamic();
	$(".dsize3").tooltip({tip:'div#dsize3TIP'}).dynamic();
	$(".contacts").tooltip({tip:'div#contactsTIP'}).dynamic();
	$(".sms").tooltip({tip:'div#smsTIP'}).dynamic();
	$(".link").tooltip({tip:'div#linkTIP'}).dynamic();
	$(".ereviews").tooltip({tip:'div#ereviewsTIP'}).dynamic();
	$(".amoled").tooltip({tip:'div#amoledTIP'}).dynamic();
	$(".sjack").tooltip({tip:'div#sjackTIP'}).dynamic();
	$(".scam").tooltip({tip:'div#scamTIP'}).dynamic();
	$(".os").tooltip({tip:'div#osTIP'}).dynamic();
	$(".android").tooltip({tip:'div#androidTIP'}).dynamic();
	$(".otrack").tooltip({tip:'div#otrackTIP'}).dynamic();
	$(".tball").tooltip({tip:'div#tballTIP'}).dynamic();
	$(".crystal").tooltip({tip:'div#crystalTIP'}).dynamic();
	$(".compass").tooltip({tip:'div#compassTIP'}).dynamic();
	$(".tvout").tooltip({tip:'div#tvoutTIP'}).dynamic();
	$(".snet").tooltip({tip:'div#snetTIP'}).dynamic();
	$(".freemem").tooltip({tip:'div#freememTIP'}).dynamic();
	$(".weight").tooltip({tip:'div#weightTIP'}).dynamic();
	$(".resolution").tooltip({tip:'div#resolutionTIP'}).dynamic();
	$(".rating").tooltip({tip:'div#ratingTIP'}).dynamic();
	$(".pros").tooltip({tip:'div#prosTIP'}).dynamic();
	$(".cons").tooltip({tip:'div#prosTIP'}).dynamic();
	$(".mslot").tooltip({tip:'div#mslotTIP'}).dynamic();
	$(".youtube").tooltip({tip:'div#youtubeTIP'}).dynamic();
	$(".im").tooltip({tip:'div#imTIP'}).dynamic();
	$(".email").tooltip({tip:'div#emailTIP'}).dynamic();
	$(".covers").tooltip({tip:'div#coversTIP'}).dynamic();
	$(".hinglish").tooltip({tip:'div#hinglishTIP'}).dynamic();
	$(".cross").tooltip({tip:'div#crossTIP'}).dynamic();
	$(".note").tooltip({tip:'div#noteTIP'}).dynamic();
	$(".mtouch").tooltip({tip:'div#mtouchTIP'}).dynamic();
	$(".cpuram").tooltip({tip:'div#cpuramTIP'}).dynamic();
	$(".completeList").tooltip({tip:'div#completeListTIP'}).dynamic();
	$(".dlna").tooltip({tip:'div#dlnaTIP'}).dynamic();
	$(".hdmi").tooltip({tip:'div#hdmiTIP'}).dynamic();
	$(".mhl").tooltip({tip:'div#mhlTIP'}).dynamic();
	$(".tethering").tooltip({tip:'div#tetheringTIP'}).dynamic();
	$(".nfc").tooltip({tip:'div#nfcTIP'}).dynamic();
	})

//image gallery navigation
	
	function imgselect(tnail){
	document.getElementById('bigpic').src=tnail.src;
	$(".gallery img").removeClass("active");
	tnail.className="active";
	}
	
	function nextimg(){
	if ($(".gallery img.active").next().length==0){k=$(".gallery img:first");}else{k=$(".gallery img.active").next();}
	$(".gallery img.active").removeClass('active');
	k.addClass('active');
	$("img#bigpic").attr("src",k.attr("src"));
	}
	
//ajax start	

	function startAJAX(){
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}

//suggestion box

function convertSuggestions(a,c){
var suggestions='';
arr=a.split(',');
l=arr.length;
for (i=0;i<l;i++){
phone=arr[i];
if (c==1){suggestions+='<a href="addPhone.php?phone='+phone+'&return=1">'+phone+'</a>';}
else{suggestions+='<a href="show-mobile.php?phone='+phone.replace(/ /g,'-')+'">'+phone+'</a>';}
}
return suggestions;
}

function showHint(str,c)
{
if (str.length<2){document.getElementById("suggestions"+c).style.display="none";return;}
else{
  document.getElementById("loading"+c).style.display="inline";
  startAJAX();  
  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
	document.getElementById("loading"+c).style.display="none";
	document.getElementById("suggestions"+c).style.display="block";
if (xmlhttp.responseText==''){document.getElementById("suggestions"+c).innerHTML="No Phone Found";}else{document.getElementById("suggestions"+c).innerHTML=convertSuggestions(xmlhttp.responseText,c);}
    }
  }
xmlhttp.open("GET","gethint.php?q="+str,true);
xmlhttp.send();
}
}

function selectall(a){
arr=document.getElementsByName(a);
k=arr.length;
for (i=0;i<k;i++){
arr[i].checked=true;
}
}

function unselectall(a){
arr=document.getElementsByName(a);
k=arr.length;
for (i=0;i<k;i++){
arr[i].checked=false;
}
}


function onlyInternational(a){
arr=document.getElementsByName(a);
k=arr.length;
for (i=0;i<k;i++){
if (arr[i].className=='i'){arr[i].checked=true;}else{arr[i].checked=false;}
}
}



function validateForm(form,a){

if (a.search('price')>-1){
pu=parseInt(form.selPriceUpper.options[form.selPriceUpper.selectedIndex].value);
pl=parseInt(form.selPriceLower.options[form.selPriceLower.selectedIndex].value);
if (pu<pl){alert("Price Range selected is not valid !");return false;}}

if (a.search('ureview')>-1){
if ((form.txtName.value.length<1) || (form.txtEmail.value.length<1)){alert("Please fill in your Name and Email to submit your review !");return false;}
if(((form.txtPlus.value.length<100) && (form.txtMinus.value.length<100))){alert("Oops, your review seems to be too short! Please mention at least a couple of positives and negatives for this phone, so that the review is more useful for all readers. Thanks!");return false;}
if (form.userConfirmation.checked==false){alert("Oops, PhoneCurry only accepts reviews from people who have used the phone themselves. Sorry!");return false;}
}

if (a.search('ufeedback')>-1){
if ((form.txtName.value.length==0) || (form.txtTestimonial.value.length==0)){alert("Name and Feedback are compulsory fields. Please check.");return false;}
}


return true;
}

function AddToCompareList(phone){
document.getElementById('cs '+phone).innerHTML='<img src="pics/icons/loading1.gif">'; 
startAJAX();
url="addPhone.php?phone="+phone;
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
if(xmlhttp.responseText==''){
document.getElementById('cs '+phone).innerHTML='<div class="greybox">Added to <a href="compare-mobile-phones.php">Compare</a> List (<a href="javascript:RemoveFromCompareList(\''+phone+'\');">Undo</a>)</div>';

//if inside compare page, refresh it (for ads)
url=window.location.href;if (url.indexOf('compare-mobile-phones')!=-1){window.location.href=url.substring(0,(url.indexOf('?')));}}

if(xmlhttp.responseText=='Limit Reached'){alert("Maximum of 4 phones can be compared at a time! You might want to remove some phones from your compare list.");document.getElementById('cs '+phone).innerHTML='<input type="button" onclick="javascript:AddToCompareList(\''+phone+'\');" value="Compare">';}
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}

function RemoveFromCompareList(phone){
document.getElementById('cs '+phone).innerHTML='<img src="pics/icons/loading1.gif">'; 
startAJAX();
url="removePhones.php?phone="+phone;
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4){
document.getElementById('cs '+phone).innerHTML='<input type="button" onclick="javascript:AddToCompareList(\''+phone+'\');" value="Compare">';
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}

function changeSort(a){
startAJAX();
url="changeSort.php?sort="+a.options[a.selectedIndex].value;
xmlhttp.onreadystatechange=function(){if (xmlhttp.readyState==4){window.location.reload();}}
xmlhttp.open("GET",url,true);
xmlhttp.send();
}

//gplusone  
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
