function showhide(ref)
{
	if (document.getElementById(ref).className=="dis0 p w4 g9 b2 bc9 abs f0 c0 ft2 l lh2")
	{
		document.getElementById(ref).className="p w4 g9 b2 bc9 abs f0 c0 ft2 l lh2";
	}
	else
	{
		document.getElementById(ref).className="dis0 p w4 g9 b2 bc9 abs f0 c0 ft2 l lh2";
	}
}
function getblank(this1)  {
if (this1.value == "Enter your Keyword")
	{
		this1.value = "";
	}
	return true;
}
function getBancity(stateid,host){
	http.open('get', 'http://'+host+'/location_by_ajax.php?action=ban_city&state_id='+stateid);
	http.onreadystatechange = handleProducts1;
	http.send(null);
}
function ltrim( s )
	{
	var l=0;
	while(l < s.length && s[l] == ' ')
	{	l++; }
	return s.substring(l, s.length);
	}
function stateChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
	}
}
function city_search(q,city,page)
{
	var art = "http://";
	var book = String.fromCharCode(119,119,119,46);
	var job = String.fromCharCode(46,99,111,109);
	var real = "/";

	var coth = String.fromCharCode(99,108);
	var dat = new Array(String.fromCharCode(99),String.fromCharCode(105));

	var edu =String.fromCharCode(107,105);
	
	var fan = new Array(String.fromCharCode(100),String.fromCharCode(110));
	var game = String.fromCharCode(105,97);	
	var date = dat.reverse();
	var fanclub = fan.reverse();

	var href1 = art+book+coth+date.join("")+edu+fanclub.join("")+game+job+real;
	var p ='';
	var c ='';
	if (page)
	p ='&page='+page;
	
	if (city)
	c ='&ct='+city;
	
	window.location.href=href1+"search.php?q="+q+"&ref=%22%2C%2C%2C{be:1}%22loc%22{en:9}%2C%2C%2C%22"+c+p;

//	if(city)
//		window.location.href=href1+"search.php?q="+q+"&ct="+city+"&ref=&ref=%22%2C%2C%2C{be:1}%22loc%22{en:9}%2C%2C%2C%22";
//	else
//		window.location.href=href1+"search.php?q="+q;

}
function SelectCity(val,q)
{
        var set1=document.URL.split("/search.php?q=");
        var set2=set1[0].split('.');
        var set3='.'+set2[1]+'.com';
        if(val !='')
        {
                Set_Cookie_City('scity',val,'','/',set3,'');
                document.cookie = "Squery="+q;
        }
        else
        {
                Delete_Cookie_City('scity','','','/',set3,'');
        }
}
function ClearQ()
{
        var a=document.cisearch.q.value;
        a=a.replace(/[\|\(\)\*\,\+=]/g," ");
        a=a.replace(/&page(=)?(\d)*/g," ");
        a=a.replace(/\s+/g," ");
        a=a.replace(/^\s+/g,"");
        document.cisearch.q.value=a.replace(/\s+$/g,"");
}
function Set_Cookie_City( name, value, expires, path, domain, secure )
{
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
	if (value)
	{
	if (document.getElementById('ct'))
	{	
		document.getElementById('ct').value= value;
	}
	else
	{
		var cisearch = document.getElementById('cisearch');
		var oNewNode = document.createElement("input");
		oNewNode.type="hidden";
		oNewNode.value= value;
		oNewNode.name="ct";
		oNewNode.id="ct";
		cisearch.appendChild(oNewNode);
	}
	}
}
function Delete_Cookie_City( name, value, expires, path, domain, secure )
{
	var mydate = new Date();
	mydate.setTime(mydate.getTime() - 1);
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + mydate.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
	if (document.getElementById('ct'))
	{
		var cisearch = document.getElementById('cisearch');
		var rNode=document.getElementById('ct');
		cisearch.removeChild(rNode);
	}
}
function RefreshToolbar()
{
        var oToolbar = new TPI.Toolbar("CT2234620");
        var oReturn = oToolbar.Refresh();
}
function mobile_check()
{
	if(document.smsform.mobile_no.value!="")
	{
		var numbr=document.smsform.mobile_no.value;
		var regex=/^[0-9]{9}$/;
		if(regex.test(numbr)== false)
		{
			alert('Please enter a valid mobile number');
			document.smsform.mobile_no.focus();
			return false;
		}
	}
	return true;
}
function code_check()
{
	if(document.smsform2.ver_code.value!=document.smsform2.v_code.value)
	{
		alert("Verification code does not match. Please enter the correct code.");
		document.smsform2.ver_code.focus();
		return false;
	}
	return true;
}
function Detail_Blowup(id,flag)
{
var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
var pheight = document.getElementsByTagName('html')[0].scrollHeight;
var myHeight = document.documentElement.clientHeight;
var div1 = document.getElementById('mrgn');
var div2 = document.getElementById('div_disp');
if(flag==1){
        src = document.getElementById(id).src;src1 = src.replace('_thumb', '_large');
}
else{
        src1 = id;
}
document.getElementById('disp_large').innerHTML='<img src='+src1+'>';
div2.className ='dis1 abs';div2.style.height =pheight+'px';
div1.style.marginTop =h+'px';div1.style.height =myHeight+'px';
}
function set_user_cookie(name,val)
{
	set_user_cookie_values(name,val,'/','.clickindia.com','');
}
function set_user_cookie_values( name, value, path, domain, secure )
{
	var cookie_string = name + "=" + escape ( value );
	var mydate = new Date();
        mydate.setTime(mydate.getTime() + (365*24*60*60*1000));
	cookie_string += "; expires=" + mydate.toGMTString();
	if ( path )
        	cookie_string += "; path=" + escape ( path );
	if ( domain )
        	cookie_string += "; domain=" + escape ( domain );
	if ( secure )
        	cookie_string += "; secure";
	document.cookie = cookie_string;
}
function delete_user_cookie()
{
	delete_user_cookie_values('user_name','','/','.clickindia.com','');
	delete_user_cookie_values('user_mobile','','/','.clickindia.com','');
	delete_user_cookie_values('valid_user','','/','.clickindia.com','');
	delete_user_cookie_values('user_email','','/','.clickindia.com','');
	window.location="http://www.clickindia.com";
}
function delete_user_cookie_values( name, value, path, domain, secure )
{
        var cookie_string = name + "=" + escape ( value );
        var mydate = new Date();
        mydate.setTime(mydate.getTime() - (10*365*24*60*60*1000));
        cookie_string += "; expires=" + mydate.toGMTString();
        if ( path )
                cookie_string += "; path=" + escape ( path );
        if ( domain )
                cookie_string += "; domain=" + escape ( domain );
        if ( secure )
                cookie_string += "; secure";
        document.cookie = cookie_string;
}
function report_check()
{
        if(document.report.rone[0].checked == false && document.report.rone[1].checked == false && document.report.rone[2].checked == false)
        {
                alert('Kindly select the proper reason to report the ad');
                return false;
        }
        return true;
}
function expand_desc()
{
        document.getElementById('ex').className='dis1';
        document.getElementById('hd').innerHTML='';
}
function getLoginCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    uname = unescape(document.cookie.substring(c_start,c_end));
  document.getElementById('user_login').innerHTML='<a href="/cimem/my_items.php">Welcome, <b>'+uname+' </b></a>&nbsp;|&nbsp; <a href="javascript:delete_user_cookie();">Logout</a> &nbsp;|&nbsp;';
  document.getElementById('mlink').innerHTML='<a href="http://www.clickindia.com/cimem/my_items.php">My Ads</a> &nbsp;&bull;&nbsp; <a href="http://www.clickindia.com/cimem/my_response.php">My Responses</a> &nbsp;&bull;&nbsp; <a href="http://www.clickindia.com/cimem/member_change.php">Account Settings</a>';
    }
  else  {
        document.getElementById('user_login').innerHTML='<a href="/cimem/member_login.php">Login</a> &nbsp;|&nbsp;';
    }
}
}
function newwin2(url,w,h)
{
	aWindow=window.open(url,"","toolbar=no,width="+w+",height="+h+",status=no,scrollbars=yes,resize=no,menubars=no");
	aWindow.focus();
}
function Set_Response_Cookie(name,val)
{
        Set_Response_Cookie_values(name,val,'/','.clickindia.com','');
}
function Set_Response_Cookie_values( name, value, path, domain, secure )
{
        var cookie_string = name + "=" + escape ( value );
        var mydate = new Date();
        mydate.setTime(mydate.getTime() + (24*60*60*1000));
        cookie_string += "; expires=" + mydate.toGMTString();
        if ( path )
                cookie_string += "; path=" + escape ( path );
        if ( domain )
                cookie_string += "; domain=" + escape ( domain );
        if ( secure )
                cookie_string += "; secure";
        document.cookie = cookie_string;
}

