function showTip(c,div){if(c.value.length == 0){try{$(div).fadeIn();}catch(e){}}}
function hideTip(div){$(div).fadeOut();}
function showTip1(div){$(div).slideDown();}
function submitComment(){stop = 0;$('input[@type="text"]').each(function(index,obj){if(obj.value == ""){stop =1;}});
$('textarea').each(function(index,obj){if(obj.value == ""){stop =1;}});
if(stop == 1){$('#loading').empty();$('#loading').append("<font size=2 face=arial color=red><B>Please fillup all the fields</B></font>");$('#loading').show();return false;}
$('#loading').empty();$('#loading').append("<font size=2 face=arial color=green>Posting your comments, please wait...</font>");
$('#loading').show();$.post('ajaxphp/postcomments.php',$('#postCommentForm').serialize(),function(data){
data = data.replace('\\','');
$('#loading').html('<font size=2 face=arial color=green>Thank you very much for your comments</font>');$('#cph').html(data);$('#comment_form_table').fadeOut('slow');$('#cph').slideDown('slow');$('#com_titie').hide();});return false;}
function digg(page_url,anc,lnk){$.post('ajaxphp/digg.php','page_url='+page_url,function(data){$(anc).html(data);$(anc).fadeIn('slow');$(lnk).fadeOut('fast');$(lnk).html('<font size=1 face=verdana color=#FF128D>Thank you</font>');$(lnk).fadeIn('slow');});}
function showLoginForm(){$('#lld').hide();$('#lfd').fadeIn('slow');$('#email').focus();}
function loginTryAgain(){$('#loading').hide();$('#lfd').fadeIn('slow');$('#email').focus();}
function login1(){$('#lfd').hide();var myDate=new Date();t=myDate.getTime();$.ajax({type: "POST",url: "ajaxphp/login.php",data: $('#lf').serialize()+"&rand="+t,cache: false,success: function(data){if(data==1){window.location.reload(true);}else{$('#loading').html(data);$('#loading').show();}}});}
function addToFav(container,story){if(arguments.length == 1){frac = arguments[0];fracpart = frac.split("favlink_");if(typeof(fracpart[1])!="undefined"){qs = "?ptopic="+escape(fracpart[1]);}else{qs = "";}$(arguments[0]).html('<a href="http://news.bollysite.com/login.html'+qs+'" title="Login"><font size=1 face=arial color="#0063DC"><B>Login</B></font></a><font size=1 face=arial color="#444444"> or </font><a href="http://news.bollysite.com/register.html'+qs+'" title="Register"><font size=1 face=arial color="#0063DC"><B>Register</B></font></a>');}else{	dataToSent = "topic="+escape(story)+"&ret=ajax";$.get('http://news.bollysite.com/addtofav.html',dataToSent,function(data){$(container).html(data).wrap('<span style="font-size:11px;font-family:Tahoma"></span>');});}}
function removeFromFav(container,container1,container2,story){if(confirm('Are you sure, you want to remove this story from your favourites?')){dataToSent = "topic="+escape(story)+"&ret=ajax";$.get('http://news.bollysite.com/removefromfav.html',dataToSent,function(data){if(data == "done"){$(container).hide();$(container1).hide();$(container2).hide();}});}}
function showDC(obj){$(obj).slideToggle('slow');}
function hidelogin(){$('#lfd').hide();$('#lld').fadeIn();}
function showChooseUserNameForm(){$('#screenform').html("<form id='screenform' style='display:inline'><input type='text' onkeyup='checkUNAvail(this);'  name='username' id='username' value=''><input disabled  id='username_submit' type='button' value='Confirm' onclick='JavaScript:saveUserName();' ></form>");$('#username').focus();}
function gobyid(o){if(document.getElementById){return document.getElementById(o);}else if(document.all){return document.all[o];}}
function checkUNAvail(obj){if(obj.value.length > 4){jQuery.ajax({type: "POST",url:"ajaxphp/screennameavail.php",data:$('#screenform').serialize(),beforeSend: function(){$('#loadingMsg1').show();},cache: false,success: function(data){if(data==1){$('#loadingMsg1').html("&nbsp;<font color=green><B>"+ gobyid('username').value +"</B> is available.</font>");gobyid("username_submit").disabled = false;}else{$('#loadingMsg1').html("&nbsp;<font color=red><B>"+ gobyid('username').value +"</B> is not available.</font>");gobyid("username_submit").disabled = true;}}});}else{$('#loadingMsg1').html("<font color=red size=2>Must be min 5 characters long.</font>");gobyid("username_submit").disabled = true;}} 
function saveUserName(){if(confirm("Are you sure, to keep " + gobyid('username').value + "as your screen name?\n\nOnce you click 'OK', it won't be changed ever.")){$.ajax({type: "POST",url: "ajaxphp/saveusername.php",data: $('#screenform').serialize(),beforeSend: function(){$('#loading').show();},cache: false,success: function(data){if(data==1){if(typeof(window.postpage) == "undefined"){$('#loadingMsg1').hide();$('#screenform').html(gobyid('username').value);}else{window.location.reload(true);}}else{alert(data);}}});}}

function commentvote(id,vtype){
if(arguments.length != 2)return;
params = 'id='+id+"&vtype="+vtype;
fdiv = "#"+vtype+id;
fdiv1 = "#points"+id;
ni = new Image();
ni.src = "/images/ok.png";
data1 = "<img src='"+ni.src+"'>";
$.post('ajaxphp/votecomment.php',params,function(data){
if(data != 0){
$(fdiv).html(data1);
$(fdiv1).html(data);
}
});
}