Array.prototype.unique = function () {
	var r = new Array();
	for(var i = 0, n = this.length; i < n; i++)
	{
		r[this[i]] = i;
	}
	var rr = new Array();
	count = 0;
	for(i in r)
	{
		rr[count] = i;
		count++;
	}
	return rr;
}

var widgetArray = new Array();
var widgetJsArray = new Array();

function suggest(type,$city)
{
	
var url="/js2/"+type+".js";
 var xmlHttp;
	    try
	    {
		    // Firefox, Opera 8.0+, Safari
		    xmlHttp=new XMLHttpRequest();
	    }
	    catch (e)
	    {
		    // Internet Explorer
		    try
		    {
		      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		    }
		    catch (e)
		    {
		    	try
		        {
		        	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		        }
		      	catch (e)
		        {
			        alert(browser_support);
			        return false;
		        }
	        }
	    }
		 
		 
		xmlHttp.onreadystatechange=function()
	    {
			if(xmlHttp.readyState==4)
			{    
				if(type=='tags')
				{
					var mytags=eval(xmlHttp.responseText);
					var mytags1 =  mytags[0]; 
						sugg_tags = mytags1; 
	 	               	  tagS =  mytags1; 
						  var ov_arr = new Array();
						  for(cid in sugg_tags)
						  {
						  	ov_arr = ov_arr.concat(sugg_tags[cid]);
							
						  }
						  ov_arr = ov_arr.unique();
						  sugg_tags['all'] = ov_arr;
						 
						  

				}
				else if(type == 'areas')
				{
					var mytags=eval(xmlHttp.responseText);
					area_array = mytags[0];
				} 
				else
				{ 
				//alert('Suggest Tags:</br>'+xmlHttp.responseText);
					var mytags=eval(xmlHttp.responseText);
					//alert('mytags is:'+mytags);
					vendor_tags=mytags.split('+');
				}
				
	        }
	    }
		
	    xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		
}

function auto_tags()
{
 var xmlHttp;
	    try
	    {
		    // Firefox, Opera 8.0+, Safari
		    xmlHttp=new XMLHttpRequest();
	    }
	    catch (e)
	    {
		    // Internet Explorer
		    try
		    {
		      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		    }
		    catch (e)
		    {
		    	try
		        {
		        	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		        }
		      	catch (e)
		        {
			        alert(browser_support);
			        return false;
		        }
	        }
	    }
		 
		 
		xmlHttp.onreadystatechange=function()
	    {
			if(xmlHttp.readyState==4)
			{    
				sugg_tags=eval(xmlHttp.responseText);
				tags=sugg_tags;
	        }
	    }

		

xmlHttp.open("GET","/index.php/admin/tags",true);
					xmlHttp.send(null);

}

function compareEmail()
{
	  if(document.getElementById('Email').value=="")
	  {
		alert(email_required);
		return false;
	  }
	  else if(document.getElementById('Email').value.indexOf('@',0) == -1 || document.getElementById('Email').value.indexOf('.',0) == -1 )
	  {
		alert(email_format);
		return false;
      }
	  if(document.getElementById('Email').value != document.getElementById('CnEmail').value)
	  {
	   	 alert(email_confirm);
		return false;

	  }
	  else{
		 return true;
	  }
} 	
 	function init_e()
 	{
 	    // check browser
 	    isMozilla = (document.all) ? 0 : 1;
 	
 	
 	    if (isMozilla)
 	    {
 	        document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
 	    }
 	 	
 	}
 	
 	// call init
 	init_e();


function selecttab(tabid)
{
   if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( tabid);
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[tabid];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[tabid];
   return elem;
}
function submit_comment(){
var comm   = document.getElementById('user_comment');
if(comm.value == ''){
					alert(enter_comment);
					comm.focus();
					return false;
					}
document.comment.submit()

}

function showDiv(id)
{ 
   mytab1 = selecttab(id);
	if(mytab1)
   mytab1.style.display = 'block';
}
function showme(id)
{
 document.getElementById(id).style.display='block';
}
function showDiv1(id)
{
   mytab1 = selecttab(id);
	if(mytab1)
   mytab1.style.display = 'block';
}

function hideDiv(id)
{
   mytab1 = selecttab(id);
	if(mytab1){
   		mytab1.style.display = 'none';
	}
}

function hideDiv1(id)
{
   mytab1 = selecttab(id);
	if(mytab1)
   mytab1.style.display = 'none';
}


//show OR hide funtion depends on if element is shown or hidden
function shoh(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
		} else {
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
			} else {
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				document.all.id.style.display = 'none';
			}
		}
	}
}

function toggle_div(id)
{
	shoh(id);
}

function moveIt(obj, mvTop, mvRt) {
	obj.style.position = "absolute";
	obj.style.top = mvTop;
	obj.style.right = mvRt;
}



function showLogin2()
{
	//var e = window.event;
	//alert(e);

//	return;
   mytab1 = selecttab('login_out');
   moveIt(mytab1,'600px','400px');
   mytab1.style.display = 'block';
 	mytab1.style.visibility = "opaque";

   mytab1 = selecttab('loginid');
   mytab1.focus();
}

function showLogin1()
{
   mytab1 = selecttab('login_out');
   mytab1.style.display = 'block';
   mytab1.style.visibility = "opaque";

   mytab1 = selecttab('loginid');
   mytab1.focus();
}

function showLogin()
{
	shoh('login_out');

   mytab1 = selecttab('loginid');
   mytab1.focus();
}
function hideLogin()
{
   mytab1 = selecttab('login_out');
   mytab1.style.display = 'none';
// mytab1.style.visibility = "visible";
}

function showforgotDiv()
{
   mytab1 = selecttab('forgot');
   mytab1.style.display = 'none';
}



function displayWindow(e)
{
	showLogin();
}
		     
function submitRating(attributeId, rating, counter)
{
		document.getElementById(attributeId).style.width= (rating*20)+"px";//xmlHttp.responseText;
		document.getElementById('ratingVal'+counter).value=rating;
}


function validateCity(){
	var serch = document.getElementById('search_for');
	
	var val = document.getElementById('citySelect');
	if(serch.value == ''){
			alert(find_Recommendations);
			return false;
	}
	if(val == null)
			val = document.getElementById('city');
	if(val.selectedIndex == 0)
	{
		alert(select_one_city);
		return false;
	}
	return true;
}

function validate_Submit_Rec(frm){
		var frmObj = document.getElementById(frm);
		var store  = document.getElementById('store_name');
		var sug    = document.getElementById('suggestion');
		var comm   = document.getElementById('comment');
		var rating = document.getElementById('ratingVal1');
		var sug_pattern = /[^\w\_\s\,\'\-]+/g
				if(store.value == '' ){
					alert(business_name);
					store.focus();
					return false;
			}else if(sug.value == ''){
					alert(recommendation_required);
					sug.focus();
					return false;
			}else if(sug.value.search(sug_pattern)>=0){
					alert(special_chars_notAllowed);
					sug.focus();
					return false;
			}else if(comm.value == ''){
					alert(reasons_required);
					comm.focus();
					return false;
			}else if(rating.value == ''){
				alert(store_rating);
				return false;
			}
			return true;
	}

function validate_Sub_Recomed(frmObj){
			var sug_pattern = /[^\w\_\s\,\'\-]+/g
			if(frmObj.recommend_value.value == '' ){
					alert("Please fill required fields [Store Name] ");
					frmObj.recommend_value.focus();
					return false;
			}else if(frmObj.suggestion1.value == ''){
					alert("Please fill required fields [Recommendations]");
					frmObj.suggestion1.focus();
					return false;
			}else if(frmObj.suggestion1.value.search(sug_pattern)>=0){
					alert("Special charecters are not allowed [Recommendations]");
					frmObj.suggestion1.focus();
					return false;
			}
			else if(frmObj.rec_message.value == ''){
					alert("Please fill required fields [Reason]");
					frmObj.rec_message.focus();
					return false;
			}else if(frmObj.ratingVal0.value == ''){
				alert("Please give rating for the store");
				return false;
			}
			return true;
	}

function checkValidContact(frmObj){
		var valid=true;
		var pattern = /^[0-9]{10,12}$/;	
			if(frmObj.message.value ==''){
				alert("Please fill required fields [message]");
				frmObj.message.focus();
				valid = false;	
			}else if(frmObj.message.value !='' && frmObj.message.value.length > 300 ){
					alert("Your message/Question should not tbe greater than 300 charecters");
					frmObj.message.focus();
					valid = false;		
			}else if(	frmObj.user_name.value == ''){
				alert("Please fill required fields [username]");
				frmObj.user_name.focus();
				valid = false;
			}else if( frmObj.user_mobile.value == ''){
				alert("Please fill required fields [mobileno]");
				frmObj.user_mobile.focus();
				valid = false;
			}else if( !pattern.test(frmObj.user_mobile.value) ){
				alert(mobile_valid);
				frmObj.user_mobile.focus();
				valid = false;
			}else if(frmObj.user_email.value == ''){
				alert("Please fill required fields [Email]");
				frmObj.user_email.focus();
				valid = false;
			}else if(!checkValidEmail( frmObj.user_email.value ) ){
				alert("Please give a valid emailid");
				frmObj.user_email.focus();
				valid = false;
			}
			return valid;
	}
	
function checkValidDeal(frmObj){
		var pattern = /^[0-9]{10,12}$/;
		var valid  = true;
		var mobile = document.getElementById('d_ph_no');
		var sms    = document.getElementById('d_sms');
		var inbox  = document.getElementById('inbox');
		var ntemail= document.getElementById('ntemail');
		
		if( sms.checked!= true && inbox.checked!= true && ntemail.checked!= true ){
				alert(alert_type);
				valid = false;
		}
		if( sms.checked== true){
			if( !pattern.test(mobile.value) ){
					alert(mobile_valid);
					mobile.focus();
					valid = false;
			}
		}
		return valid;
	}
function checkmobile(obj,ob){
		var pattern = /^[0-9]{10,12}$/;
		var valid  = true;
		var mobile = document.getElementById(ob+'_ph_no');
		var sms    = document.getElementById(ob+'_sms');
		if( sms.checked== true){
			if( !pattern.test(mobile.value) ){
				alert(mobile_valid);
				mobile.focus();
				valid = false;
			}
	   }
	   if(valid){
		if(document.getElementById(obj+'_verify').style.display=='block'){
		 document.getElementById(obj+'_verify').innerHTML='';
		 document.getElementById('d_button').style.display='block';
		}
	  }	
	}
	function checkcontact(obj,ob){
		var pattern = /^[0-9]{10,12}$/;
		var valid  = true;
		var mobile = document.getElementById(ob+'_ph_no');
		if( !pattern.test(mobile.value) ){
				alert(mobile_valid);
				mobile.focus();
				valid = false;
		}
		
		if(valid)
		{
			if(document.getElementById(obj+'_verify').style.display=='block')
			{
			 document.getElementById(obj+'_verify').innerHTML='';
			 document.getElementById('c_button').style.display='block';
			 }
		}	
	}
	
	function check_Send_Email(frmId){
		var frmObj = document.getElementById(frmId);
		var emails = document.getElementById('user_emails');
		if(emails.value!=''){
				var tmp_email = emails.value.split(',');
				for(var index=0; index < tmp_email.length; index++){
						ind_email = trim(tmp_email[index]);
						if( ! checkValidEmail( ind_email) ){
							alert("Please give valid emails separated by comma");
							emails.focus();
							return false;
						}
				}
		}else{
			alert("Please give valid emails only "," seperated");
			emails.focus();
			return false;
		}
		document.email.submit();
	}
	
	function showLoginForm(obj,ob)
	{
		var login =document.getElementById('hid_login').value;
		if(login=='0' || login==''){
			if(document.getElementById(ob+'_button').style.display=='block')
			document.getElementById(ob+'_button').style.display='none';
			var myblock="<div align='left' ><table style='padding-left:5px;'align='left'><tr><td colspan='2'><div id='l_error'style='padding-left:20px;'></div></td></tr><tr style='padding-top:2px;'><td  class='login_field'>User Name :</td><td  class='login_field'><input id='d_loginid' name='d_loginid' type='text' /></td></tr><tr style='padding-top:2px;'><td  class='login_field'>Password :</td><td  class='login_field'><input name='d_pwd' id='d_pwd' type='password' /></td></tr><tr><td colspan='2' align='center'><a href='#' onclick=\"javascript:submit_login('"+obj+"' , '"+ob+"');\"><img src='/images/login_sidebut.gif' style='padding-left:5px;border:0' /></a></td></tr></table></div>";
			document.getElementById(obj+'_verify').style.display='block';
	   	    document.getElementById(obj+'_verify').innerHTML=myblock;
			return false;
		}else{
 			var myblock="<div align='left' style='padding-top:2px; padding-bottom:2px;' 0><div style='padding-left:20px; float:left;' class='gen_txt' id='ph_auth'> </div></div>";
			document.getElementById(obj+'_verify').innerHTML=myblock;
			document.getElementById(ob+'_button').style.display='none';
			return true;
		}
			
	}
	
	function submitcontact(obj,ob)
	{ 	
	var frmObj = document.getElementById(obj);
	
		var valid  = true;
			valid = checkValidContact(frmObj);
		if(valid)
		{   
			var myblock="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div style='padding-left:20px; float:left;' class='gen_txt' id='ph_auth'> </div></div>";
			document.getElementById(obj+'_verify').innerHTML=myblock;
			if(document.getElementById(ob+'_user_ph_no').value!=document.getElementById(ob+'_ph_no').value)
			{ 
				document.getElementById('c_button').style.display='none';
				document.getElementById(obj+'_verify').style.display = 'block';
				submitpopup_Activation(obj,ob);
			}
			else
			{
				document.contact.submit();
				document.getElementById(obj+'_verify').style.display = 'block';
				var content="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div id='info'><div style='float:left;' class='login_field'>Processing the request..</div><div id='ph_auth'></div></div></div>";
					document.getElementById(obj+'_verify').innerHTML=content;	
			}
			
		}
	}
	function submitrecommend(obj,ob)
	{
		
		var frmObj = document.getElementById(obj);
		var valid  = true;
		if(ob == 'r')
		{
			valid =validate_Sub_Recomed(frmObj);
		}else if(ob == 'r1')
		{
			valid =validate_Submit_Rec(obj);
		}
		if(valid)
		{	
			var login =document.getElementById('hid_login').value;
			
			if(login=='0' || login=='')
			{ 
				document.getElementById(ob+'_button').style.display='none';
				var myblock="<div align='center' style='padding-left:100px;float:left;'> <table align='left' style='padding-left:50px;'><tr><td align='left' colspan='2'><div id='l_error'style='padding-left:20px;'></div></td></tr><tr><td colspan='2' align='left' style='padding-top:2px;' class='login_field'><input type='checkbox' name='anonymus' id='anonymus'  checked='true' />Send as Anonymous user</td></tr><tr><td style='padding-top:2px;' class='login_field'>User Name :</td><td><input id='d_loginid' name='d_loginid' onfocus=\"javascript:clearanonymus('"+obj+"');\" type='text' /></td></tr><tr><td style='padding-top:2px;' class='login_field'>Password :</td><td><input name='d_pwd' id='d_pwd' onfocus=\"javascript:clearanonymus('"+obj+"');\" type='password' /></td></tr><tr><td colspan='2' align='center'><a href='#' onclick=\"javascript:submitrec('"+obj+"' , '"+ob+"');\"><img src='/images/submit_but.gif' style='margin-top:10px;border:0' /></a></td></tr></table></div>";
				
				 document.getElementById(obj+'_verify').style.display='block';
				 document.getElementById(obj+'_verify').innerHTML=myblock;
				 return false;

			}
			else
			{
				
				if(obj=='rec1')
				document.rec1.submit();
				else{
					document.getElementById('rec_store1').submit();
//					document.rec_store1.submit();
				}
				 var content="<div align='left' style='padding-top:2px; padding-bottom:2px;'><div id='info'><div style=' float:left;' class='login_field'>Thank you for your Recommendation.</div><div id='ph_auth'></div></div></div>";
					document.getElementById(obj+'_verify').innerHTML=content;	
			}

		}
		
	}
	function clearanonymus(obj)
	{
			var anony = document.getElementById('anonymus');
		//var frmObj = document.getElementById(obj);
		anony.checked = false;
//		frmObj.anonymus.checked =false;
  }
	
	function submitrec(obj,ob)
	{
		var anony = document.getElementById('anonymus');
		var frmObj = document.getElementById(obj);
		if(anony.checked == false)
		{
					if( document.getElementById('d_loginid').value == '' || document.getElementById('d_pwd').value == '' )
					{
						alert("Please fill user name and Password");
						return false;
					}else
					submit_login(obj,ob);
		
		}
		else
		{
			if(obj=='rec1')
				document.rec1.submit();
				if(obj=='rec_store1'){
					document.getElementById('rec_store1').submit();
//					document.rec_store1.submit();
				}
				 var content="<div><img src='/images/login_up.gif' /></div><div align='left' style='padding-top:2px; padding-bottom:2px;' ><div id='info'><div style='float:left;' class='login_field'>Thank you for your Recommendation.</div><div id='ph_auth'></div></div><div style='float:left; width:100%;'><img src='/images/login_dwn.gif' /></div></div></div>";
					document.getElementById(obj+'_verify').innerHTML=content;	
		}
	    
	}
	function submitmobile(obj,ob)
	{
				var pattern = /^[0-9]{10,12}$/;
				var mobile = document.getElementById('m_ph_no');
				var valid=true;
			if( !pattern.test(mobile.value))
			{
					alert(mobile_valid);
					mobile.focus();
					valid = false;
			}
			if(valid)
			{
						var myblock="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div style='padding-left:20px; float:left;' class='gen_txt' id='ph_auth'> </div></div>";
		document.getElementById(obj+'_verify').innerHTML=myblock;
		 document.getElementById(ob+'_button').style.display='none';
					   document.getElementById(obj+'_verify').style.display = 'block';
						submitpopup_Activation(obj,ob);
				
			
			}
		
	}
	
	
	function submitdeal(obj,ob)
	{ 
		var frmObj = document.getElementById(obj);
	
		var valid  = true;
		if(ob == 'c')
		{
			valid = checkValidContact(frmObj);
		}else if(ob == 'd')
		{
			valid = checkValidDeal(frmObj);
		}else if(ob == 's')
		{
				var pattern = /^[0-9]{10,12}$/;
				var mobile = document.getElementById('s_ph_no');
			if( !pattern.test(mobile.value))
			{
					alert(mobile_valid);
					mobile.focus();
					valid = false;
			}
		}
		else if(ob == 'hs')
		{
				var pattern = /^[0-9]{10,12}$/;
				var mobile = document.getElementById('hs_ph_no');
			if( !pattern.test(mobile.value))
			{
					alert(mobile_valid);
					mobile.focus();
					valid = false;
			}
		}
		else if(ob == 'm')
		{
				var pattern = /^[0-9]{10,12}$/;
				var mobile = document.getElementById('m_ph_no');
			/*if( !pattern.test(mobile.value))
			{
					alert(mobile_valid);
					mobile.focus();
					valid = false;
			}*/
		}
		else if(ob == 'r')
		{
		valid =validate_Sub_Recomed(frmObj);
		 }
		
		if(valid)
		{	
			  if((document.getElementById(ob+'_ph_no').value!='') && (document.getElementById(ob+'_user_ph_no').value!=document.getElementById(ob+'_ph_no').value))
			   {
					   document.getElementById(obj+'_verify').style.display = 'block';
						submitpopup_Activation(obj,ob);
				}
				else
				{ 
						if(obj=='sdeal'){
						  document.sdeal.submit();
						   var content="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div id='info'><div style=' float:left;' class='login_field'>Deal alert on your mobile was set</div><div id='ph_auth'></div></div></div>";
					document.getElementById(obj+'_verify').innerHTML=content;	
					}
						if(obj=='sms'){
						  document.sms1.submit();
						   var content="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div id='info'><div style=' float:left;' class='login_field'>Contact information has been sent to your mobile.</div><div id='ph_auth'></div></div></div>";
					document.getElementById(obj+'_verify').innerHTML=content;	
					}
						if(obj=='hotsms'){
						  document.hotsms.submit();
						   var content="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div id='info'><div style=' float:left;' class='login_field'>Deal alert on your mobile was set</div><div id='ph_auth'></div></div></div>";
					document.getElementById(obj+'_verify').innerHTML=content;	
					}  
					
				}
			
		}
		
	}
	
	function clickcall(obj,ob)
	{ 
		var frmObj = document.getElementById(obj);
	
		var valid  = true;
		var pattern = /^[0-9]{10,12}$/;
		var mobile = document.getElementById('c2c_ph_no');
			if( !pattern.test(mobile.value))
			{
					alert(mobile_valid);
					mobile.focus();
					valid = false;
			}
			if(valid)
			{ 
			var myblock="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div style='padding-left:20px; float:left;' class='gen_txt' id='ph_auth'> </div></div>";
				document.getElementById(obj+'_verify').innerHTML=myblock;
				document.getElementById(ob+'_button').style.display='none';
				
				if((document.getElementById(ob+'_ph_no').value!='') && (document.getElementById(ob+'_user_ph_no').value!=document.getElementById(ob+'_ph_no').value))
			   {
					   document.getElementById(obj+'_verify').style.display = 'block';
						submitpopup_Activation(obj,ob);
				}
				else{
					   document.getElementById(obj+'_verify').style.display = 'block';
					    click_call(document.getElementById('merchant').value);
				
				}
				
						
			}
	}
	
	
	function checkValidEmail(address) {
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   return reg.test(address);
	}
	
    function submit_login(obj,ob)
	{   
		var user=document.getElementById('d_loginid').value;
		
		var pwd=document.getElementById('d_pwd').value;
		
			var url="/login";
			var params="loginid="+user+"&pwd="+pwd+"&deal=1"
	 var xmlHttp;
	    try
	    {
		    // Firefox, Opera 8.0+, Safari
		    xmlHttp=new XMLHttpRequest();
	    }
	    catch (e)
	    {
		    // Internet Explorer
		    try
		    {
		      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		    }
		    catch (e)
		    {
		    	try
		        {
		        	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		        }
		      	catch (e)
		        {
			        alert(browser_support);
			        return false;
		        }
	        }
	    }
		 
		 
		xmlHttp.onreadystatechange=function()
	    {
	    	if(xmlHttp.readyState==4)
			{ var str=xmlHttp.responseText;
					str=str.split("/");
					
				if(trim(str[0]) =="success")
				{
				  document.getElementById('hid_login').value=2;
				   if(obj=='rec1'|| obj =='rec_store1')
				   {
					 if(obj == 'rec1')
					   document.rec1.submit();
					else if(obj == 'rec_store1')
					  document.rec_store1.submit();
					 var content="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div id='info'><div style='float:left;' class='login_field'><img src='/images/ajax-loader.gif'/>Processing please wait..</div><div id='ph_auth'></div></div></div>";
					document.getElementById(obj+'_verify').innerHTML=content;	  
					}
				  else
				  { 
					   if(document.getElementById(ob+'_user_ph_no'))
					   {
					   document.getElementById(ob+'_user_ph_no').value=str[1];
					   submitdeal(obj,ob);
					   }
					   var content="<div align='left' style='padding-top:2px; padding-bottom:2px;' ><div id='info'><div style='float:left;' class='login_field'>Successfully Logged in</div><div id='ph_auth'></div></div></div>";
						document.getElementById(obj+'_verify').innerHTML=content;
				  }
				}
				  else
				  {
					document.getElementById('l_error').innerHTML="<span class='failed_msg'>Login Failed !&nbsp;&nbsp;Please try</span>";
				   }
			
	        }
	    }
		
	    var valid = (ob == 'rec1')?checkRecommend(document.getElementById(ob)):(ob == 'rec_store1')?checkRec1(document.getElementById(ob)):true;
		if(valid == true){
			xmlHttp.open("post",url,true);
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", params.length);
			xmlHttp.send(params);
		}

	}	
		
	
	
	function submitpopup_Activation(obj,ob)
	{ 
	    var mobile = document.getElementById(ob+'_ph_no').value;
		var xmlHttp;
		if(obj=='contact1')
			{
			  var email=document.getElementById(ob+'_email').value;
			  var name=document.getElementById(ob+'_username').value;
			  var url="/index.php/dashboard/sendActCode?mobile=" + mobile+"&email="+email+"&name="+name;
			}
		else
             var url="/index.php/dashboard/sendActCode?mobile=" + mobile;	
	
	    try
	    {
		    // Firefox, Opera 8.0+, Safari
		    xmlHttp=new XMLHttpRequest();
	    }
	    catch (e)
	    {
		    // Internet Explorer
		    try
		    {
		      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		    }
		    catch (e)
		    {
		    	try
		        {
		        	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		        }
		      	catch (e)
		        {
			        alert(browser_support);
			        return false;
		        }
	        }
	    }
		 
		 
		xmlHttp.onreadystatechange=function()
	    { 
			var myblock="<div align='left' style='padding-top:2px; padding-bottom:2px;' 0><div style='padding-left:20px; float:left;' class='gen_txt' id='ph_auth'> </div></div>";
			document.getElementById(obj+'_verify').innerHTML=myblock;
			document.getElementById(ob+'_button').style.display='none';
			document.getElementById('ph_auth').innerHTML="<img src='/images/ajax-loader.gif'/>Processing the request..";
	    	if(xmlHttp.readyState==4){ 
			
			var myblock="<div id='"+ob+"_smsErrors'  style='background-color:#f3f8f8;display:none'></div> <div style=' float:left;' ><p align='jusitfy'> Your mobile number has not been authenticated.<br>A four digit CODE will be SMSed to your mobile</p></div><div style='padding-top:3px; float:left;' class='login_field'>Enter the code :&nbsp;<input type='text' style='margin-top:8px;' id='act_no' name='number' /><input type='hidden'  id='ph_no'  value='"+mobile+"' /><p><div align='center'><input type='button' class='buttons' name='button' value='Verify' onclick=\"javascript:activate_popup('"+obj+"' , '"+ob+"');\" /></div></p></div><div></div>";
		
				 document.getElementById('ph_auth').innerHTML= myblock;
				   
	        }
	    }
		/*
		<div><img src='/images/spacer.gif' height='5px' width='150px' /></div>
		*/
	    xmlHttp.open("GET",url,true);
	    xmlHttp.send(null);

	
	
}
function  activate_popup(obj,ob)
{ 	
var act_no = document.getElementById('act_no').value;
	var ph_no = document.getElementById(ob+'_ph_no').value;
	
					var xmlHttp;
					try
					{
						// Firefox, Opera 8.0+, Safari
						xmlHttp=new XMLHttpRequest();
					}
					catch (e)
					{
						// Internet Explorer
						try
						{
						  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
						}
						catch (e)
						{
							try
							{
								xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
							}
							catch (e)
							{
								alert(browser_support);
								return false;
							}
						}
					}
					xmlHttp.onreadystatechange=function()
					{
						if(xmlHttp.readyState==4)
						{
                            if(trim(xmlHttp.responseText) == "success"){
								document.getElementById(ob+'_user_ph_no').value =ph_no ;
								var myblock="Your mobile number is now successfully authenticated<br/>";
								if(obj == 'sdeal'){
								document.sdeal.submit();
								 myblock+="<img src='/images/ajax-loader.gif'/>Submitting your Deal";
								}
								else if(obj == 'contact1'){
								document.contact.submit();
								myblock+="<img src='/images/ajax-loader.gif'/>Submitting Contact information";								}
								else if(obj == 'sms'){
								document.sms1.submit();
								 myblock+="<img src='/images/ajax-loader.gif'/>Submitting your request";
								}
								else if(obj == 'hotsms'){
								document.hotsms.submit();
								 myblock+="<img src='/images/ajax-loader.gif'/>Submitting your request";
								}
								else if(obj == 'click2call'){
								 myblock+="<img src='/images/ajax-loader.gif'/>Connecting the call..";
								}
								else if(obj == 'frm_mobile'){
								//document.sms.submit();
								 myblock+="<div  style='float:left; padding-left:8px;'><input type='image' src='/images/closebut.gif' style='border:0' onclick='javascript:tb_remove();return false;'/></div>";
								}
								
								if(document.getElementById('info'))
								{
									 document.getElementById('info').innerHTML= myblock;
									  if(obj == 'click2call'){
									  click_call(document.getElementById('merchant').value);
									  }
									}else
									{
									document.getElementById('ph_auth').innerHTML=myblock;
									if(obj == 'click2call'){
									  click_call(document.getElementById('merchant').value);
									  }
									}
								   
							}
							else{
								var myblock="<img src='/images/error.gif' style='padding-top:2px;'>&nbsp;&nbsp;" + xmlHttp.responseText;

								//if(document.getElementById('info'))
								//{  
										document.getElementById(ob+'_smsErrors').style.display='block';
									 document.getElementById(ob+'_smsErrors').innerHTML= myblock;
								//	}else
								//	{			
								//	document.getElementById('ph_auth').innerHTML=myblock;
								//	-loader.gif
								
														
							}
							 
						}
					}
					
					xmlHttp.open("GET","/index.php/dashboard/mobileActivate?activation_code="+ act_no + "&mobile="+ph_no,true);
					xmlHttp.send(null);
	
}

 function sleep(delay)
 {
     var start = new Date().getTime();
     while (new Date().getTime() < start + delay);
 }


function click_call(m_number)
{ 
				var xmlHttp;
					try
					{
						// Firefox, Opera 8.0+, Safari
						xmlHttp=new XMLHttpRequest();
					}
					catch (e)
					{
						// Internet Explorer
						try
						{
						  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
						}
						catch (e)
						{
							try
							{
								xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
							}
							catch (e)
							{
								alert(browser_support);
								return false;
							}
						}
					}
					xmlHttp.onreadystatechange=function()
					{
						if(xmlHttp.readyState==4)
						{   
						var sid=trim(xmlHttp.responseText);
							sleep(5000);
							click_status(sid);
						}
					}
xmlHttp.open("GET","/click2call/"+m_number,true);
xmlHttp.send(null);
	}
	
var call_status=new Array("Your mobile is ringing","Merchant mobile is ringing","You accepted the call","Merchant accepted the call","Call connected ","Call disconnected","Your are busy in a call"," Merchant is busy in a call","Your number is wrong","Merchant number is wrong");
var check_status=new Array();
function click_status(sid){
var status_id=sid;

					var xmlHttp;
					try
					{
						// Firefox, Opera 8.0+, Safari
						xmlHttp=new XMLHttpRequest();
					}
					catch (e)
					{
						// Internet Explorer
						try
						{
						  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
						}
						catch (e)
						{
							try
							{
								xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
							}
							catch (e)
							{
								alert(browser_support);
								return false;
							}
						}
					}
					xmlHttp.onreadystatechange=function()
					{
						if(xmlHttp.readyState==4)
						{ var len=check_status.length;
						check_status[len]=trim(xmlHttp.responseText);
							if(document.getElementById('ph_auth'))
								{
								 if(trim(xmlHttp.responseText)=='sms'){
								 document.getElementById('ph_auth').innerHTML= "Due to Error in the connection,SMS sent to merchant";
									}
								else if(trim(xmlHttp.responseText) < 5)
									 {
									  document.getElementById('ph_auth').innerHTML= call_status[trim(xmlHttp.responseText)];
									  sleep(3000);
									  click_status(status_id);
									  }
								else if(trim(xmlHttp.responseText) == 5)
									 { if(len>1){
										  if(check_status[len-1]==5){
										  sleep(3000);
										  click_status(status_id);
										  }
										  else
											document.getElementById('ph_auth').innerHTML= call_status[trim(xmlHttp.responseText)]+"<br/><input type='image' src='/images/closebut.gif' style='border:0' onclick='javascript:window.location.reload();return false;'/>";
											}
										else
										{
										document.getElementById('ph_auth').innerHTML="Connecting the call..";
										sleep(3000);
										 click_status(status_id);
										 }

									 }
									 else
									 {
									 document.getElementById('ph_auth').innerHTML= call_status[trim(xmlHttp.responseText)]+"<br/><input type='image' src='/images/closebut.gif' style='border:0' onclick='javascript:window.location.reload();return false;'/>";
										}
									 
									
							}		
						}
					}
xmlHttp.open("GET","/click2callstatus/"+status_id,true);
xmlHttp.send(null);
	


}


	function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}


function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			document.getElementById('menu_tit').className='menutitlehide';
			el.style.display = "block";
		}else{
			document.getElementById('menu_tit').className='menutitle';
			el.style.display = "none";
		}
	}
}

/* Functions for just Prev/Next type of pagination */
function switchpage2(pageTableId, pageNumber, totalPages, tabId)
{
	//alert("Trying to swich pages");
	for(i = 1; i <= totalPages; i ++)
	{
		hideDiv(tabId + '_' + i);
	}
	showDiv(tabId + '_' + pageNumber);
	paginate2(pageTableId, pageNumber, totalPages, tabId);
	window.location.hash="anchor";
}


function switchpage(pageTableId, pageNumber, totalPages, tabId, sideId)
{
	//alert("Trying to swich pages");
	for(i = 1; i <= totalPages; i ++)
	{
		hideDiv(tabId + '_' + i);
	}
	showDiv(tabId + '_' + pageNumber);
	paginate(pageTableId, pageNumber, totalPages, tabId,sideId);

	if(sideId)
	{
		for(i = 1; i <= totalPages; i ++)
		{
			if(pageNumber == i)
			{
				hideDiv(sideId + '_' + i);
			}
			else
			{
				showDiv(sideId + '_' + i);
			}
		}
	}
	window.location.hash="anchor";


}

function paginate2(pageTableId, pageNumber, totalPages, tabId)
{
//alert(totalPages);
//alert("table id is " + pageTableId + " number = "+ pageNumber +		"totalPages = " + totalPages + "tabId = " + tabId);

	if(totalPages <= 1)
		return;

	var tblObj = document.getElementById(pageTableId);
	if(pageNumber == 1)
	{
		innerVal1 = 'Previous';
	}
	else
	{
		innerVal1 = "<a href='javascript:void(0)' onclick=\"javascript:switchpage2( '" + 
			pageTableId +"'  , " + (pageNumber -1) + "  , " + totalPages+ " , '" + tabId+ 
			"' ); \" > Previous </a> ";
	}

	if(pageNumber == totalPages)
	{
		innerVal2 = 'Next';
	}
	else
	{
		innerVal2 = "<a href='javascript:void(0)' onclick=\"javascript:switchpage2( '" + pageTableId + 
			"' , " + 			(pageNumber + 1) + " , " + totalPages +  " , '" + 
			tabId + "' ); \" > Next </a> ";
	}
	tblObj.innerHTML    = innerVal1 + "&nbsp;&nbsp;|&nbsp;&nbsp;" + innerVal2;
}
function paginate(pageTableId, pageNumber, totalPages, tabId, sideId)
{
//alert(totalPages);
//alert("table id is " + pageTableId + " number = "+ pageNumber +		"totalPages = " + totalPages + "tabId = " + tabId);

	if(totalPages <= 1)
		return;
	if(totalPages >=5)
		pArr = new Array(5);
	else
		pArr = new Array(totalPages);

	startpage  = pageNumber - 2;
	
	if(startpage + 4 > totalPages)
	{
		startpage = totalPages - 4;
	};
	
	if(startpage  <  1)
	{
		startpage  = 1; 
	}
//alert("startpage is " + startpage);
	for(i = 0 ; i < pArr.length; i++)
	{
		pArr[i] = startpage  + i;
	}
	trId = pageTableId + '_'  + 'tr';
	var tblObj = document.getElementById(pageTableId);
	var trObj = document.getElementById(trId);
	if(trObj)
	{
		//alert("Tr id is there as " + trId);
		//alert(trObj);
		tblObj.deleteRow(-1);	
		//alert("baadme nahi aaya");
		
	}
	/* We've deleted the earlier pagination */
	var trObj = tblObj.insertRow(0);	
	////alert(trObj);
	trObj.setAttribute("id",trId);
	/* Begin Add all the pagination rows here  */
	
	 tdFirst  = document.createElement('TD');	
	 tdPrev  = document.createElement('TD');	

	 tdNext  = document.createElement('TD');	
	 tdLast  = document.createElement('TD');	


	if(sideId)
	{
		 tabId = tabId + "', '" + sideId;
	}
	if(pageNumber == 1)
	{
		tdFirst.setAttribute('class','disablepage');
		tdPrev.setAttribute('class','disablepage');
		innerVal1 = 'First';
		innerVal2 = 'Prev';
	}
	else
	{
		innerVal1 = "<a href='javascript:void(0)' onclick=\"javascript:switchpage( '" + pageTableId+ "' , 1, " + totalPages + 
			"  ,  '" + tabId+ "' ); \" >First</a> ";
		////alert(innerVal1);
		innerVal2 = "<a href='javascript:void(0)' onclick=\"javascript:switchpage( '" + pageTableId +"'  , " + (pageNumber -1) + 
			"  , " + totalPages+ " , '" + tabId+ "' ); \" > Prev </a> ";
//alert(innerVal2);
	}
	tdFirst.innerHTML = innerVal1;		
	tdPrev.innerHTML = innerVal2;

	if(pageNumber == totalPages)
	{
		tdLast.setAttribute('class','disablepage');
		tdNext.setAttribute('class','disablepage');
		innerVal1 = 'Last';
		innerVal2 = 'Next';
	}
	else
	{
		innerVal1 = "<a href='javascript:void(0)' onclick=\"javascript:switchpage('" + pageTableId + 
			"' , " + totalPages + " , " + totalPages + " , '" + tabId + "' ); \" >Last	</a> ";
		innerVal2 = "<a href='javascript:void(0)' onclick=\"javascript:switchpage( '" + pageTableId + 
			"' , " + 			(pageNumber + 1) + " , " + totalPages +  " , '" + tabId + "' ); \" > Next </a> ";
			//alert(innerVal1);
						////alert(innerVal2);
	}
	tdLast.innerHTML = innerVal1;		
	tdNext.innerHTML = innerVal2;
	
	trObj.appendChild(tdFirst);
	trObj.appendChild(tdPrev);

	for(i = 0; i < pArr.length ; i++)
	{
		tdMid = document.createElement('TD');	
		if(pageNumber == pArr[i])
		{
			tdMid.setAttribute('class','disablepage');
			innerVal = pArr[i];
		}
		else
		{
			innerVal = "<a href='javascript:void(0)' onclick=\"javascript:switchpage('" + pageTableId + "' , " + pArr[i] + 
				" , " + totalPages + " , '" + tabId + "' ); \" > " + pArr[i] + "	</a> ";

		}
		tdMid.innerHTML = innerVal;
		trObj.appendChild(tdMid);
	}
	trObj.appendChild(tdNext);
	trObj.appendChild(tdLast);
	//alert("Finally look at table" + tblObj);
	//tblObj.appendChild(trObj);	
	//alert(tblObj);
}

function forgotpop_up(obj)
	{
	if(document.getElementById(obj).style.display=='block')
	   document.getElementById(obj).style.display='none';
	  else
	   document.getElementById(obj).style.display='block';
	
	}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
 var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
 if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

//Drop Down/ Overlapping Content: http://www.dynamicdrive.com
//**Updated: Dec 19th, 07': Added ability to dynamically populate a Drop Down content using an external file (Ajax feature)
//**Updated: Feb 29th, 08':
				//1) Added ability to reveal drop down content via "click" of anchor link (instead of default "mouseover")
				//2) Added ability to disable drop down content from auto hiding when mouse rolls out of it
				//3) Added hidediv(id) public function to directly hide drop down div dynamically

var dropdowncontent={
	disableanchorlink: true, //when user clicks on anchor link, should link itself be disabled (always true if "revealbehavior" above set to "click")
 hidedivmouseout: [true,500], //Set hiding behavior within Drop Down DIV itself: [hide_div_onmouseover?, miliseconds_before_hiding]
	ajaxloadingmsg: "Loading content. Please wait...", //HTML to show while ajax page is being feched, if applicable
	ajaxbustcache: true, //Bust cache when fetching Ajax pages?

	getposOffset:function(what, offsettype){
		return (what.offsetParent)? what[offsettype]+this.getposOffset(what.offsetParent, offsettype) : what[offsettype]
	},

	isContained:function(m, e){
		var e=window.event || e
		var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
		while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
		if (c==m)
			return true
		else
			return false
	},

	show:function(anchorobj, subobj, e,category){
		
		if (!this.isContained(anchorobj, e)){
			var e=window.event || e
			if (e.type=="click" && subobj.style.visibility=="visible"){
			getElementsByClassName('a','tips',category,'hide');
				subobj.style.visibility="hidden"
				return
			}
			if(category)
			{
				getElementsByClassName('a','tips',1,'hide');
				getElementsByClassName('a','tips',category,'show');
			}
			
			var horizontaloffset=(subobj.dropposition[0]=="left")? -(subobj.offsetWidth-anchorobj.offsetWidth) : 0 //calculate user added horizontal offset
			var verticaloffset=(subobj.dropposition[1]=="top")? -subobj.offsetHeight : anchorobj.offsetHeight //calculate user added vertical offset
			subobj.style.left=this.getposOffset(anchorobj, "offsetLeft") + horizontaloffset + "px"
			subobj.style.top=this.getposOffset(anchorobj, "offsetTop")+verticaloffset+"px"
			subobj.style.clip=(subobj.dropposition[1]=="top")? "rect(auto auto auto 0)" : "rect(0 auto 0 0)" //hide drop down box initially via clipping
			subobj.style.visibility="visible"
			subobj.startTime=new Date().getTime()
			subobj.contentheight=parseInt(subobj.offsetHeight)
			if (typeof window["hidetimer_"+subobj.id]!="undefined") //clear timer that hides drop down box?
				clearTimeout(window["hidetimer_"+subobj.id])
			this.slideengine(subobj, (subobj.dropposition[1]=="top")? "up" : "down")
		}
	},

	curveincrement:function(percent){
		return (1-Math.cos(percent*Math.PI)) / 2 //return cos curve based value from a percentage input
	},

	slideengine:function(obj, direction){
		var elapsed=new Date().getTime()-obj.startTime //get time animation has run
		if (elapsed<obj.glidetime){ //if time run is less than specified length
			var distancepercent=(direction=="down")? this.curveincrement(elapsed/obj.glidetime) : 1-this.curveincrement(elapsed/obj.glidetime)
			var currentclip=(distancepercent*obj.contentheight)+"px"
			obj.style.clip=(direction=="down")? "rect(0 auto "+currentclip+" 0)" : "rect("+currentclip+" auto auto 0)"
			window["glidetimer_"+obj.id]=setTimeout(function(){dropdowncontent.slideengine(obj, direction)}, 10)
		}
		else{ //if animation finished
			obj.style.clip="rect(0 auto auto 0)"
		}
	},

	hide:function(activeobj, subobj, e,category){
	
		if (!dropdowncontent.isContained(activeobj, e)){
			window["hidetimer_"+subobj.id]=setTimeout(function(){
			
				subobj.style.visibility="hidden"
				subobj.style.left=subobj.style.top=0
				clearTimeout(window["glidetimer_"+subobj.id])
			}, dropdowncontent.hidedivmouseout[1])
		}
	},

	hidediv:function(subobjid){
	
			document.getElementById(subobjid).style.visibility="hidden"
	},

	ajaxconnect:function(pageurl, divId){
		var page_request = false
		var bustcacheparameter=""
		if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc
			page_request = new XMLHttpRequest()
		else if (window.ActiveXObject){ // if IE6 or below
			try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
			} 
			catch (e){
				try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
				}
				catch (e){}
			}
		}
		else
			return false
		document.getElementById(divId).innerHTML=this.ajaxloadingmsg //Display "fetching page message"
		page_request.onreadystatechange=function(){dropdowncontent.loadpage(page_request, divId)}
		if (this.ajaxbustcache) //if bust caching of external page
			bustcacheparameter=(pageurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
		page_request.open('GET', pageurl+bustcacheparameter, true)
		page_request.send(null)
	},

	loadpage:function(page_request, divId){
		if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
			document.getElementById(divId).innerHTML=page_request.responseText
		}
	},

 init:function(anchorid, pos, glidetime, revealbehavior,category){
   
 		var anchorobj=document.getElementById(anchorid)
		var subobj=document.getElementById(anchorobj.getAttribute("rel"))
		var subobjsource=anchorobj.getAttribute("rev")
		if (subobjsource!=null && subobjsource!="")
			this.ajaxconnect(subobjsource, anchorobj.getAttribute("rel"))
		subobj.dropposition=pos.split("-")
		subobj.glidetime=glidetime || 1000
		subobj.style.left=subobj.style.top=0
		if (typeof revealbehavior=="undefined" || revealbehavior=="mouseover"){
			anchorobj.onmouseover=function(e){dropdowncontent.show(this, subobj, e,category)}
			anchorobj.onmouseout=function(e){dropdowncontent.hide(subobj, subobj, e,category)}
			if (this.disableanchorlink) anchorobj.onclick=function(){return false}
		}
		else
			anchorobj.onclick=function(e){
									dropdowncontent.show(this, subobj, e,category); 
									return false
							}
		if (this.hidedivmouseout[0]==true) //hide drop down DIV when mouse rolls out of it?
			subobj.onmouseout=function(e){dropdowncontent.hide(this, subobj, e,category)}
	}
}

function getElementsByClassName(strTagName, strClassName,cat,type){

	var oElm='document';
	var arrElements = (strTagName == "*" && document.all)? document.all : document.getElementsByTagName(strTagName);
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	var oElement1;
	var category;
		for(var i=0; i<arrElements.length; i++)
		{
			oElement = arrElements[i];
			oElement1 = arrElements[i].id;
			category=arrElements[i].title;
			if(oRegExp.test(oElement.className)){
			 if(cat==0)
				dropdowncontent.init(oElement1, "right-top", 300, "click",category)
				else
				{ 	
					if(type=='show')
						arrElements[i].href=arrElements[i].href+mm_encode(cat);
					else if(type=='hide')
					{
						var reffer=arrElements[i].href;
						reffer=reffer.split('/');
						arrElements[i].href=reffer[0]+'/'+reffer[1]+'/'+reffer[2]+'/'+reffer[3]+'/';
					}
						
				}
				
			}
		}
		
	}
	
	
function createWidget(suggestion,container, tagArray, noDelim )
{  if(tagArray!=null){
	widgetJsArray[suggestion] = new YAHOO.widget.DS_JSArray(tagArray);
	widgetArray[suggestion] = new YAHOO.widget.AutoComplete(suggestion,container, widgetJsArray[suggestion]);
	widgetArray[suggestion].prehighlightClassName = "yui-ac-prehighlight"; 
				//widgetArray[suggestion].applyLocalFilter = true; 
				widgetArray[suggestion].useIFrame = true; 
				widgetArray[suggestion].useShadow = false; 
				widgetArray[suggestion].minQueryLength =1; 
				widgetArray[suggestion].allowBrowserAutocomplete = false; 
				widgetArray[suggestion].typeAhead = false;
				widgetArray[suggestion].autoHighlight = false;
				
				
				
				
				if(noDelim)
				{
				
				}
				else
				{
					widgetArray[suggestion].delimChar = ","; 
				}
				widgetArray[suggestion].textboxFocusEvent.subscribe(function(){
					var sInputValue = YAHOO.util.Dom.get(autoArray[i]['suggestion']).value;
					if(sInputValue.length === 0) {
						var oSelf = this;
						setTimeout(function(){oSelf.sendQuery(sInputValue);},0);
					}
				});
				}
}
function createWidgetMatch(suggestion,container, tagArray, noDelim )
{  if(tagArray!=null){

				widgetJsArray[suggestion] = new YAHOO.widget.DS_JSArray(tagArray);
				widgetJsArray[suggestion].queryMatchContains = true;
				widgetArray[suggestion] = new YAHOO.widget.AutoComplete(suggestion,container, widgetJsArray[suggestion]);
				widgetArray[suggestion].prehighlightClassName = "yui-ac-prehighlight"; 
				widgetArray[suggestion].useIFrame = true; 
				widgetArray[suggestion].useShadow = false; 
				widgetArray[suggestion].minQueryLength =2; 
				widgetArray[suggestion].typeAhead = false;
				widgetArray[suggestion].autoHighlight = false; 
				widgetArray[suggestion].allowBrowserAutocomplete = false;
								
				if(noDelim)
				{
				
				}
				else
				{
					widgetArray[suggestion].delimChar = ","; 
				}
				widgetArray[suggestion].textboxFocusEvent.subscribe(function(){
					var sInputValue = YAHOO.util.Dom.get(autoArray[i]['suggestion']).value;
					if(sInputValue.length === 0) {
						var oSelf = this;
						setTimeout(function(){oSelf.sendQuery(sInputValue);},0);
					}
				});
				}
}
function in_tag(tag)
{ var check=document.getElementById('suggestion1').value;
var mycheck=false;
if(check)
{
 check=check.split(',');
	 for(var i=0;i<check.length-1;i++)
	 { 
		if(mycheck!=true)
		{
			if(check[i]==tag)
			  mycheck=true;
		}
		  
	 }
	 if(mycheck!=true)
	 document.getElementById('suggestion1').value+=tag+",";
 }
 else
 document.getElementById('suggestion1').value+=tag+",";

}

function ValidContact(){
 var name 	 = document.getElementById('name');  
 var from    = document.getElementById('from');
 var subject = document.getElementById('subject');
 var message = document.getElementById('message');
 var hid     = document.getElementById('hid_contact');
 if(name.value ==''){
	 alert("Please give your name ");
	 name.focus();
	 return false;
 }else if( from.value == ''){	
 	alert("Please fill from field");
	from.focus();
	return false;
 }else if( from.value !=''){
	if(!checkValidEmail(from.value)){
		alert("Please give valid Email");
		from.focus();	
		return false;
	}
 }
 if( subject.value == ''){
	 alert("Please fill subject field");
	 subject.focus();
	 return false;
 }
 if(message.value == ''){
	 alert("Please give message to send");
	 message.focus();
	 return false;
 }
 hid.value =1;
 return true;
}

function  sendMobileCoupon()
{
	var phnumber = document.sms.number.value ; 
	var smsurl = document.sms.smsurl.value;
	if(phnumber.length <= 0)
	{
		alert(req_failed);
		return false;
	}
	else
	{
		var xmlHttp;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
			  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert(browser_support);
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{	
				if(xmlHttp.responseText == "success"){
					alert(coupon_sent);
					return true;					
				}
				else{
					alert(xmlHttp.responseText);
					alert(error_sending_coupon);
				}
			}
		}
		
		xmlHttp.open("GET",smsurl,true);
		xmlHttp.send(null);
	}
}

function shownext(city,id){
        var current=id-1;
        var curr_page=city+'_'+current;
        var next_page=city+'_'+id;
                if(document.getElementById(next_page))
                {
                        document.getElementById(curr_page).style.display='none';
                        document.getElementById(next_page).style.display='block';
                }

}

function showprevi(city,id){
        var prev=id-1;
        var curr_page=city+'_'+id;
        var prev_page=city+'_'+prev;
                if(document.getElementById(prev_page))
                {
                        document.getElementById(curr_page).style.display='none';
                        document.getElementById(prev_page).style.display='block';
                }

}

