var _path='/';function isset(varname)
{if(typeof(window[varname])!="undefined")return true;else return false;}
function sure(msg)
{if(msg==undefined)
{var msg='Are you sure?';}
var ask=confirm(msg);if(ask==true)
{return true;}
else
{return false;}}
function showstates()
{var country=$("#country").val();changecountry(country);if(country==='US')
{$("#state-p").fadeIn();$("#states").removeAttr("disabled");}
else
{if($("#state-p").css("display")!='none')
{$("#state-p").fadeOut();$("#states").attr("disabled","disabled");}}}
function changecountry(country)
{country=country.toLowerCase();if(country=='')
{$("#countryimg").remove();}
if($("#countryimg").length>0)
{$("#countryimg").attr("src","/images/flags/"+country+".gif");}
else
{$("#country").after("");}}
function cp_imadd()
{var count=$(".ims").length;if((count+1)>5)
{alert('You can only add up to 5 different type of IM Screen Names');return false;}
var height=$("#im_opt").children("strong").css("height");var height2=height.replace(/px/,'');var newheight=parseInt(height2)+20+"px";$("#im_opt").children("strong").css("height",newheight);var next=count+1;$(".ims:last").after("\n\n\n");$(".ims:last").hide();$(".ims:last").slideDown('fast');return false;}
jQuery.fn.resizehandle=function(){return this.each(function(){var me=jQuery(this);me.after(jQuery('
').bind('mousedown',function(e){var h=me.height();var y=e.clientY;var moveHandler=function(e){me.height(Math.max(20,e.clientY+h-y));};var upHandler=function(e){jQuery('html').unbind('mousemove',moveHandler).unbind('mouseup',upHandler);};jQuery('html').bind('mousemove',moveHandler).bind('mouseup',upHandler);}));});}
function useropt()
{$("#useropt").toggle();}
function changebg(what,to)
{switch(to)
{case'yes':var color='#F2FFE4 url(\'/images/sign_yes.png\') no-repeat 95% 50%';break;case'no':var color='#FFF2F2 url(\'/images/sign_no.png\') no-repeat 95% 50%';break;case'def':var color='#F8FAFD';break;}
$('#'+what).parent().css("background",color);$('#'+what).focus();if(to=='no')
{$("#"+what).parent().find("small").css("color","red");$("#"+what).parent().find("span").css("color","red");}
else
{$("#"+what).parent().find("small").css("color","#9e9e9e");$("#"+what).parent().find("span").css("color","#9e9e9e");}}
function locksubmit(what)
{if(what==1)
{$("#submitbutton").attr("disabled","disabled");}
else
{$("#submitbutton").removeAttr("disabled");}}
function addcomment()
{if($("#comment_post").val()=='')
{alert('You must write something first.');return false;}
if($("#comment_post").val().length<10)
{alert('Your comments is too short! It must be more than 10 characters');return false;}
if($("#newcomments").html().length>1)
{$("#newcomments").children(".notes").remove();}
var data=$("#addcomment_form > input, textarea").serialize();var html='';var html=$.ajax({type:"POST",url:"/comment.php?ajax=1",data:data,async:false}).responseText;$("#newcomments").append(html);$(".comments:last").hide();$(".comments:last").fadeIn('slow');var totalcomments=$("#totalcomments").html();var newtotalcomments=parseInt(totalcomments)+1;$("#totalcomments").html(newtotalcomments);$("#comment_post").val("");setTimeout("$('.notes').fadeOut('slow');",2500);return false;}
function rateComment(id,rating,where)
{var html='';var html=$.ajax({type:"GET",url:'/rank.comments.php?id='+id+'&r='+rating,async:false,global:true}).responseText;var check=html.search(/span/);if(check!=-1)
{$('#'+where+' .comments_score').html(html);var score=$('#'+where+' .comments_score span').html();if(score<0)
{$('#'+where).parent().addClass("negative");$('#'+where).prepend("Show Comments");$('#comment-msg-'+id).hide();}
else if(score>=0)
{if($('#'+where).parent().hasClass("negative"))
{$('#'+where).parent().removeClass("negative");$('#'+where+" a:first").remove();$('#comment-msg-'+id).show();}}
return false;}
else
{$('#'+where).html(html);}
return false;}