////////////// for delete in fronet end By Amit - ///////////////
function delete_item(id,tbl)
{
	if(confirm("Do you want to delete this?"))
	{
		window.location = "delete.php?id="+id+"&tbl="+tbl;
	}
}
function subcategory(code)
{	
 $("#subcat").css('display','none');
 $("#subsubcat").css('display','none');
	$.post("ajax.php",{action1:'getsubcat',code:code}, 
						function(data)
						{
							$("#subcat").html(data);
						 	$("#subcat").css('display','block');
						}
		);
	
}
function subsubcat(subcat)
{ 
	$.post("ajax.php",{action1:'getsub',subcat:subcat}, 
						function(data)
						{
							$("#subsubcat").html(data);
						 $("#subsubcat").css('display','block');
						}
		);
}
function planid(id)
{
if(id==2)
{
document.getElementById('plan').style.display='inline';
}
else
{
document.getElementById('plan').style.display='none';
}

}
function countWords(){
    var chunk = document.form1.title.value.split(' ');
	var a = chunk.length;
	document.getElementById('titlecount').value=(16-a);
	document.getElementById('titlecount').style.display='inline';
	if(a>15)
	{
	
	document.form1.title.value=chunk.slice(0,15).join(' ');
	}

}
function countdesc(){
	var limit=''
    var chunk = document.form1.description.value.split(' ');
	var a = chunk.length;
	if(document.form1.plan.value==2)
	{
		document.getElementById('max').style.display='none';
		document.getElementById('feat').style.display='inline';
		limit=50;
	}
	else
	{
		document.getElementById('feat').style.display='none';
		document.getElementById('max').style.display='inline';
		limit=25;
	}
	document.getElementById('descount').value=(limit-a);
	document.getElementById('descount').style.display='inline';
	if(a>limit)
	{
	
	document.form1.description.value=chunk.slice(0,limit).join(' ');
	}

}

function setHomepage()
{
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
  		document.body.setHomePage('http://24-7legalhelp.com');
 
    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
   {  
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         }  
         catch(e)  
         {  
    alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");  
         }
    } 
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage','http://24-7legalhelp.com/');
 }
}
function del(url)
{
	if(confirm("Are you sure you want to delete it ?"))
	{
		window.location=url;
	}
}

function reloadCaptch()
{
	var rnd = Math.random();
	$('#captcha').attr('src','captcha/php_captcha.php?'+rnd);	
}

function hitcnt(id)
{
	$.post('sponsor_hit.php', {'id':id});
	return true;
}
