// <![CDATA[
// Begin Ad Muncher helper script
// Do not remove without removing all references to this in the below page (eg: everything containing "YZz" or "YZb")
// Retrieved from: 174.120.172.93:80
function YZzn(){return false;};function YZzbHelp(a,b){YZzWgp(a);YZzWbn();return;};function YZzb(a,b,c,d){YZzWgp(a);YZzWbn();return YZzWfw(b);};function YZzWpp(a){YZzWppa=a;if(a)YZzWorgsti("YZzWppa=0;",500);};function YZzbtePopup(a,b,c,d,e,f){YZzWgp();YZzWbn();return YZzWfw();};function YZzbModalDialog(a,b,c){YZzWgp(a);YZzWbn();return YZzWfw();};function YZzWj(m,u,l){if(YZzWolp){YZzWqn=YZzWqnbu;YZzWolp=0;};return true;};function YZzbModelessDialog(a,b,c){YZzWgp(a);YZzWbn();return YZzWfw();};function YZzWpl(a,b,c){while(a.indexOf(b)!=-1)a=a.replace(b,c);return a;};function YZzWtry(a){if(YZzWtryk())eval("try{"+a+"}catch(e){};");else eval(a);};function YZzWtrys(a){if(YZzWtryk())eval("try{"+a+"}catch(e){};");};function YZzc(){YZzWqn=YZzWqnbu=10;YZzWorgsti("YZzWqn=YZzWqnbu=0;",500);return;};function YZzW__amscript_addonload(a){YZzW_ams_onload[YZzW_ams_onload_i++]=(typeof(a)=="function")?a:new Function(a);};function YZzW__amscript_addonunload(a){YZzW_ams_onunload[YZzW_ams_onunload_i++]=(typeof(a)=="function")?a:new Function(a);};function YZzWfcs(z){YZzWfcsr=0;if(z){YZzWfcsrz=z;YZzWtry("YZzWfcsr=YZzWfcsd();");};return YZzWfcsr;};function YZzWfc(a,z){for(var i=0;i<a.length;i++)if(a[i].name==z||YZzWfc(a[i].frames,z))return 1;return 0;};function YZb(z){if(typeof(z.location)!="undefined"||typeof(z.blur)=="undefined")return false;return z.blur();};function YZzf(z){if(typeof(z.location)!="undefined"||typeof(z.focus)=="undefined")return false;return z.focus();};function YZzWHelp(a,b){if(YZzWck(a))return;if(YZzWqn)YZzWqn-=1;if(b)return showHelp(a,b);else return showHelp(a);};function YZzTimeout(a,b){if(((!YZzWqn&&!YZzWa)||YZzWppa||YZzWul)&&typeof(a)=="string")return YZzWorgsti("YZzWpp(1);"+a+";YZzWpp(0);",b);return YZzWorgsti(a,b);};function YZzInterval(a,b){if(((!YZzWqn&&!YZzWa)||YZzWppa||YZzWul)&&typeof(a)=="string")return YZzWorgsin("YZzWpp(1);"+a+";YZzWpp(0);",b);return YZzWorgsin(a,b);};function YZzWbn(){if(YZzWd&&YZzWm){if(YZzWb){YZzWc="s";YZzWb+=", "+YZzWm;}else{YZzWc="";YZzWb=YZzWm;};YZzWi="Popup"+YZzWc+" on page blocked by Ad Muncher: "+YZzWb;YZzWu();};};function YZzWox(){var x;for(var i=0;i<YZzW_ams_onunload.length;i++){if(typeof(YZzW_ams_onunload[i])=="function")YZzW_ams_onunload[i]();};if(typeof(YZzWffad)!="undefined"&&!YZzWffadd){if(YZzWkou)YZzWul=1;YZzWffadd=1;if(typeof(YZzWffad)=="function")x=YZzWffad();else eval(YZzWffad);YZzWul=0;};return x;};function YZzWModalDialog(a,b,c){if(YZzWck(a,b))return YZzWfw();if(YZzWqn)YZzWqn-=1;if(c)return showModalDialog(a,b,c);else if(b)return showModalDialog(a,b);else return showModalDialog(a);};function YZzWibd(){YZzWbid=0;YZzWtrys("if(event.which==1)YZzWbid=1;");YZzWtrys("if(event.button==1)YZzWbid=1;");YZzWtrys("var YZzWclr=arguments.callee.caller;for(var YZzWinc=0;YZzWinc++<20&&YZzWclr;){if(YZzWclr.arguments.length==1){var YZzWarg=YZzWclr.arguments[0];if(typeof(YZzWarg)=='object'&&(YZzWarg.which==1||YZzWarg.button==1))YZzWbid=1;}YZzWclr=YZzWclr.caller;}");return YZzWbid;}function YZzWs(a){if((typeof(a.target)!="undefined"&&typeof(a.action)!="undefined"&&a.target&&YZzWnw(a.target)&&YZzWck(a.action))||typeof(a.submit)=="undefined")return false;return a.submit();};function YZzWt(a){if((YZzWqn||YZzWa)&&!YZzWppa&&!YZzWul){if(YZzWqn)YZzWqn-=1;return alert(a);};if(a&&YZzWd){YZzWi="Alert message blocked by Ad Muncher: "+YZzWpl(a,"\n"," ");YZzWu();};return false;};function YZzWModelessDialog(a,b,c){if(YZzWck(a,b))return YZzWfw();if(YZzWqn)YZzWqn-=1;if(c)return showModelessDialog(a,b,c);else if(b)return showModelessDialog(a,b);else return showModelessDialog(a);};function YZzWsp(a,z){if(a.split)return a.split(z);var j,c,s,n,b,e;j=b=0;c=on.length;s=new Array();a+=z;n=a.length;while(b<n){e=z?a.indexOf(z,b):b+1;s[j++]=a.substring(b,e);b=e+c;};return s.length=j,s;};function YZzWu(a){YZzWi=YZzWpl(YZzWpl(YZzWi.substring(0,1024),'"',"<~am~`"),"<~am~`",'\\"');YZzWir='defaultStatus="'+YZzWi+'";';if(!YZzWss){YZzWss=1;YZzWorgsin("eval(YZzWir);",3000);};YZzWorgsti("eval(YZzWir);",1000);};function YZzWe(){YZzWa=0;YZzWqnbu=YZzWqn;YZzWqn=0;YZzWolp=1;YZzWorgsti("YZzWa=1;",1000);if(!YZzWffd){YZzWffd=1;for(var i=0;i<YZzW_ams_onload.length;i++){if(typeof(YZzW_ams_onload[i])=="function")YZzW_ams_onload[i]();};if(typeof(YZzWff)!="undefined"){if(typeof(YZzWff)=="function")YZzWff();else eval(YZzWff);};};YZzWqn=YZzWqnbu;YZzWolp=0;YZzWx();};function YZzWnw(a){YZzWagt=navigator.userAgent.toLowerCase();if(a!="_self"&&a!="_top"&&a!="_main"&&a!="_parent"&&!YZzWfcs(a)&&((YZzWagt.indexOf("msie")==-1||YZzWagt.indexOf("opera")!=-1)||(a!="_search"&&a!="_media")))return 1;return 0;};function YZzWobx(){var x;if(typeof(YZzWffreunload)!="undefined"&&!YZzWffreunloadd){if(YZzWkou)YZzWul=1;YZzWffreunloadd=1;if(typeof(YZzWffreunload)=="function")x=YZzWffreunload();else eval(YZzWffreunload);YZzWffreunloadd=0;YZzWul=0;};return x;};function YZzWtryk(){var b=navigator.userAgent.toLowerCase();var c=parseInt(navigator.appVersion);if((b.indexOf("mozilla")!=-1&&b.indexOf("compatible")== -1&&c>=5)||(b.indexOf("opera")!=-1&&c>=6)||(b.indexOf("msie")!=-1&&c>=4))return 1;return 0;};function YZzWfcsd(){var v=self;if(YZzWfc(v.frames,YZzWfcsrz)||(typeof(v.name)!="undefined"&&v.name==YZzWfcsrz))return 1;while(v!=v.parent){v=v.parent;if(YZzWfc(v.frames,YZzWfcsrz)||(typeof(v.name)!="undefined"&&v.name==YZzWfcsrz))return 1;};return 0;};function YZzWtePopup(a,b,c,d,e,f){if(YZzWck())return YZzWfw();if(YZzWqn)YZzWqn-=1;if(f)return createPopup(a,b,c,d,e,f);else if(e)return createPopup(a,b,c,d,e);else if(d)return createPopup(a,b,c,d);else if(c)return createPopup(a,b,c);else if(b)return createPopup(a,b);else return createPopup(a);};function YZzWmc(){if(typeof(document.layers)!="undefined")document.captureEvents(Event.KeyDown|Event.MouseUp|Event.Blur|Event.KeyPress|Event.Move|Event.Click|Event.KeyUp|Event.Reset|Event.Change|Event.Load|Event.Resize|Event.DblClick|Event.MouseDown|Event.Select|Event.DragDrop|Event.MouseMove|Event.Submit|Event.Error|Event.MouseOut|Event.Unload|Event.Focus|Event.MouseOver);document.onmouseup=YZzWr;return 0;};function YZzWck(a,b){if(!YZzWul&&!YZzWppa&&(YZzWibd()||YZzWro||YZzWqn||YZzWa||(b&&!YZzWnw(b)))){return 0;};YZzWgp(a);var l,s,c;for(var i=0;i<YZzWpmx.length;i++){l=0;s=YZzWsp(YZzWpmx[i],"*");for(var z=0;z<s.length;z++){c=YZzWn.indexOf(s[z],l);if(c==-1){l=0;break;};l=c;};if(l)return 0;};YZzWbn();if(YZzWrp){YZzWrpi5=YZzWrpi4;YZzWrpi4=YZzWrpi3;YZzWrpi3=YZzWrpi2;YZzWrpi2=YZzWrpi1;YZzWrpi1=new Image();var YZzWzn;YZzWtry("YZzWzn=document.referrer");YZzWrpi1.src="http://www.admuncher.com/cgi-bin/pr.pl?p="+escape(YZzWm)+"&s="+escape(document.location.href)+"&r="+escape(YZzWzn)+"&v=4.73.30615&l=2266";};return 1;};function YZzWr(e){YZzWqn=YZzWqnbu=10;YZzWorgsti("YZzWqn=YZzWqnbu=0;",500);if(typeof(document.YZzWuseup)!="undefined"){if(typeof(document.YZzWuseup)=="function")return document.YZzWuseup(e);else return eval(document.YZzWuseup);};if(typeof(document.YZzWuseup)!="undefined"){if(e||typeof(window.event)!="undefined"){if(typeof(document.YZzWuseup)=="function"){YZzWpp(0);var YZzWtn=document.YZzWuseup(e);YZzWpp(1);return YZzWtn;}else return eval("YZzWpp(1);"+document.YZzWuseup+";YZzWpp(0);");};if(typeof(document.YZzWuseup)=="function")return document.YZzWuseup(e);else return eval(document.YZzWuseup);};return true;};function YZzWx(){YZzWtry('if(typeof(window.onload)=="undefined")window.onload=YZzWe;else{YZzWq=""+window.onload;if(!window.onload||!YZzWq||YZzWq.indexOf("YZzWe")!=-1)window.onload=YZzWe;};if(typeof(window.onunload)=="undefined")window.onunload=YZzWox;else{YZzWq=""+window.onunload;if(!window.onunload||!YZzWq||YZzWq.indexOf("YZzWox")!=-1)window.onunload=YZzWox;};if(typeof(window.onbeforeunload)=="undefined")window.onbeforeunload=YZzWobx;else{YZzWq=""+window.onbeforeunload;if(!window.onbeforeunload||!YZzWq||YZzWq.indexOf("YZzWobx")!=-1)window.onbeforeunload=YZzWobx;};if(typeof(window.onmouseup)=="undefined")YZzWmc();else{YZzWq=""+document.onmouseup;if(!window.onmouseup||!YZzWq||YZzWq.indexOf("YZzWr")!=-1){YZzWmc();};};');};function YZzWgp(a){if(a){var YZzWckjs=/[A-Za-z]+:/;if(a.search(YZzWckjs)!=-1){if(a.substring(0,5).toLowerCase()!="http:"){YZzWm="(No URL)";YZzWn=a.toLowerCase()+" "+document.URL.toLowerCase();return;};};YZzWp="/admuncherpopcheck&"+Math.random()+"&"+document.URL;YZzWmi3=YZzWmi2;YZzWmi2=YZzWmi1;YZzWmi1=new Image();YZzWn=a;YZzWnn=YZzWn.indexOf("#");if(YZzWnn!=-1)YZzWn=YZzWn.substring(0,YZzWnn);YZzWmi1.src=YZzWn+YZzWp;YZzWnn=YZzWmi1.src.indexOf(YZzWp);if(YZzWnn!=-1)YZzWm=YZzWmi1.src.substring(0,YZzWnn);YZzWn=YZzWm.toLowerCase()+" "+document.URL.toLowerCase();}else{YZzWm="(No URL)";YZzWn=document.URL.toLowerCase();YZzWp="/admuncherpopchecknourl&"+Math.random();YZzWmi3=YZzWmi2;YZzWmi2=YZzWmi1;YZzWmi1=new Image();YZzWmi1.src=document.URL+YZzWp;};};function YZzW(a,b,c,d){if(YZzWck(a,b))return YZzWfw(b);if(YZzWqn)YZzWqn-=1;if(!a)a="";if(typeof(c)=="string"){c=YZzWpl(c.toLowerCase()," ","");if(YZzWw){c=YZzWpl(c,"height=","xxx=");c=YZzWpl(c,"width=","xxx=");c=YZzWpl(c,"top=","xxx=");c=YZzWpl(c,"left=","xxx=");c=YZzWpl(c,"screenx=","xxx=");c=YZzWpl(c,"screeny=","xxx=");};if(YZzWy){c=YZzWpl(c,"location=","xxx=");c=YZzWpl(c,"toolbar=","xxx=");c=YZzWpl(c,"menubar=","xxx=");c=YZzWpl(c,"resizable=","xxx=");c=YZzWpl(c,"scrollbars=","xxx=");c=YZzWpl(c,"status=","xxx=");c=YZzWpl(c,"titlebar=","xxx=");c=YZzWpl(c,"fullscreen=","xxx=");c=YZzWpl(c,"directories=","xxx=");};};if(YZzWy){if(typeof(c)=="string")c+=",";else c="";c+="location,toolbar,menubar,resizable,scrollbars,status,titlebar,directories";};if(d)return YZzWorgo(a,b,c,d);else if(c)return YZzWorgo(a,b,c);else if(b)return YZzWorgo(a,b);else return YZzWorgo(a);};function YZzWso(c,a){if(typeof(a)=="string"&&a.substring(0,11)=="javascript:"){a=a.substring(11,a.length);};if(typeof(YZzWsod[c])=="undefined"||!YZzWsod[c]){YZzWsod[c]=1;var x=new Array('quot22','amp26','lt3C','gt3E','nbspA0','iexclA1','centA2','poundA3','yenA5','brvbarA6','sectA7','umlA8','copyA9','ordfAA','laquoAB','notAC','shyAD','regAE','macrAF','degB0','plusmnB1','sup2B2','sup3B3','acuteB4','microB5','paraB6','middotB7','cedilB8','sup1B9','ordmBA','raquoBB','frac14BC','frac12BD','frac34BE','iquestBF','AgraveC0','AacuteC1','AcircC2','AtildeC3','AumlC4','AringC5','AEligC6','CcedilC7','EgraveC8','EacuteC9','EcircCA','EumlCB','IgraveCC','IacuteCD','IcircCE','IumlCF','ETHD0','NtildeD1','OgraveD2','OacuteD3','OcircD4','OtildeD5','OumlD6','timesD7','OslashD8','UgraveD9','UacuteDA','UcircDB','UumlDC','YacuteDD','THORNDE','szligDF','agraveE0','aacuteE1','acircE2','atildeE3','aumlE4','aringE5','aeligE6','ccedilE7','egraveE8','eacuteE9','ecircEA','eumlEB','igraveEC','iacuteED','icircEE','iumlEF','ethF0','ntildeF1','ograveF2','oacuteF3','ocircF4','otildeF5','oumlF6','divideF7','oslashF8','ugraveF9','uacuteFA','ucircFB','uumlFC','yacuteFD','thornFE','yumlFF');var l,m;for(var i=0;i<x.length;i++){if (typeof(x[i])=="string"){l=x[i].length;m="&"+x[i].substring(0,(l-2))+";";a=YZzWpl(a,m,unescape("%"+x[i].substring((l-2),l)));};};if(c==1)YZzWff=new Function(a);if(c==2)YZzWffad=new Function(a);if(c==3)YZzWffreunload=new Function(a);};};function YZzWfw(b){var r=new Object();for(i in window)r[i]=window[i];var v=new Array("scrollBy","getSelection","scrollByLines","scrollByPages","sizeToContent","dump","setTimeout","setInterval","clearTimeout","clearInterval","setResizable","captureEvents","releaseEvents","routeEvent","enableExternalCapture","disableExternalCapture","prompt","open","openDialog","find","alert","confirm","focus","blur","back","forward","home","stop","print","moveTo","moveBy","resizeTo","resizeBy","scroll","close","show","updateCommands","escape","unescape","atob","btoa","addEventListener","removeEventListener","dispatchEvent","getComputedStyle");for(var i=0;i<v.length;i++)r[v[i]]=YZzn;v=new Array("captureEvents","close","open","releaseEvents","clear","writeln","getElementById","getElementsByName","elementFromPoint","createEvent","getSelection","write","createElement","createElementNS","createDocumentFragment","createTextNode","createComment","createAttribute","getElementsByTagName","importNode","attachEvent","detachEvent","hasAttributes","addEventListener","removeEventListener","dispatchEvent","contains","insertBefore","replaceChild","removeChild","appendChild","hasChildNodes","isSupported","normalize","cloneNode");r.document=new Object();for(var i=0;i<v.length;i++)r.document[v[i]]=YZzn;r.document.body=new Object();r.document.body.style=new Object();r.name=b;r.amwin="a";r.location=new Object(YZzWm);r.location.href=YZzWm;r.location.hash=window.location.hash;r.location.host=window.location.host;r.location.hostname=window.location.hostname;r.location.pathname=window.location.pathname;r.location.port=window.location.port;r.location.protocol=window.location.protocol;r.location.search=window.location.search;YZzWclct+=1;eval("YZzWpc["+YZzWclct+"]=r;YZzWorgsti(\"YZzWpc["+YZzWclct+"].closed=true;\",1500);");return r;};if(typeof(self.YZzWinited)=="undefined"){var YZzWinited=1;var YZzWa,YZzWb,YZzWc,YZzWd,YZzWi,YZzWir,YZzWk,YZzWm,YZzWmi1,YZzWmi2,YZzWmi3,YZzWn,YZzWnn,YZzWp,YZzWq,YZzWss,YZzWv,YZzWw,YZzWy,YZzWro,YZzWolp,YZzWqn,YZzWqnbu,YZzWplt,YZzWagt,YZzWtz,YZzWti,YZzWsa,YZzWeb,YZzWrp,YZzWrpi1,YZzWrpi2,YZzWrpi3,YZzWrpi4,YZzWrpi5,YZzWppa,YZzWffd,YZzWorgo,YZzWorgsin,YZzWorgsti,YZzWul,YZzWkou,YZzWffreunloadd,YZzWffadd,YZzWfcsr,YZzWfcsrz;var YZzW_ams_onload_i=0;var YZzW_ams_onload=new Array();var YZzW_ams_onunload_i=0;var YZzW_ams_onunload=new Array();var YZzWsod=new Array();for(var YZzWvin="";YZzWvin!="aaaaaaaaaaaaaaaaaaaa";YZzWvin+="a")eval("var AdMch"+YZzWvin+";");var YZzWclct=0;var YZzWpc=new Array();YZzWk=1;YZzWd=1;YZzWw=0;YZzWy=0;YZzWro=0;YZzWi="";YZzWtz=0;YZzWti=0;YZzWrp=0;YZzWkou=1;var YZzWpmx=new Array('.gov/funzone/','/apps/mediaplayer/','/home/loaded.php?room=','/msgpopup.php?s=','/online/popup.html?','/playradionow.jsp?','/public/logon.do','/site/olspage.jsp?id=','/spurl.php?v=','/vspot/player.','isapi.dll?picture','webmessenger.msn.com');YZzWorgo=open;YZzWorgsti=setTimeout;YZzWorgsin=setInterval;YZzWx();if(YZzWk)YZzWtry("window.onerror=YZzWj;");var YZzWz;YZzWtry("YZzWz=document.referrer");if(!YZzWz){if(YZzWti){if(YZzWtz)YZzWz=location.protocol+"//"+location.host+"/";else YZzWz="http://www.admuncher.com/";};}else if(YZzWz.substring(0,7)=="http://"){YZzWsa=YZzWz;YZzWsa=YZzWsa.substring(7,1024);if(YZzWsa.indexOf("/")!=-1)YZzWsa=YZzWsa.substring(0,YZzWsa.indexOf("/"));if(YZzWsa!=location.host){if(YZzWtz)YZzWz=location.protocol+"//"+location.host+"/";else YZzWz="http://www.admuncher.com/";};};};
// End Ad Muncher helper script
// ]]>

$(function() {

	//ajax example

	//$.post('?test', {email:'email',user:'user'}, function(response) {

	//	alert(response);

	//});

	

	//ajax example

	//$.get('?get_featured_rant', function(response) {

		//alert(response);

	//});

	

	//each example

	//$("#frm_manage_users input[@type=checkbox]").each(function(){

		//alert($(this).val());

	//});

	

	$('.compose_message').click(function(){

		receiver_id = $(this).attr("id").substr(16);	

	});

	

	$("#send_message").click(SendMessage);

	

	$("#toggle_report").click(ToggleReport);

	

	$("#send_video_report").click(SendVideoReport);

	

	$("#add_comment").click(AddComment);

	

	$("#add_user_comment").click(AddUserComment);

	

	$("#home_request").click(HomeRequest);

	

	$(".favorites").click(Favorites);

	

	$(".add_friend").click(AddFriend);

	

	$(".remove_friend").click(RemoveFriend);

	

	$(".remove_favorite").click(RemoveFavorite);

	

	$(".accept_friend").click(AcceptFriend);

	

	$(".decline_friend").click(DeclineFriend);



	$("#select_messages").change(SelectMessages);

	

	$('a.delete_message').click(DeleteMessage);

	//delete message from details page

	$('a.del_message').click(DelMessage);

	

	//mass delete messages

	$('#mass_delete_messages').click(MassDeleteMessages);	

	

	$('a.mark_unread').click(MarkUnread);

	

	$("#recommend").click(Recommend);

	

	$('#frm_vault').submit(SearchVault);

	$('#frm_quick').submit(QuickSubmit);

	

	$('#add_part').click(AddPart);

	$('#clear_parts').click(ClearParts);

	

	$('.view_trailer').click(function(){

		last_trailer = $(this).attr("id").substr(13);							   

	});

	

	$('.recommend').click(function(){

		last_recommend = $(this).attr("id").substr(10);							   

	});

	

	if($("embed").length > 0){

		$("embed").attr("width", 540);

		$("embed").attr("height", 468);



		$("embed").css({

			'width': '540px',

			'height': '468px'

		});	

	}

	

	if($("object").length > 0){

		$("object").attr("width", 540);

		$("object").attr("height", 468);



		$("object").css({

			'width': '540px',

			'height': '468px'

		});	

	}

	

	if($("param[name=width]").length > 0){

		$("param[name=width]").attr("value", 540);

	}

	

	if($("param[name=height]").length > 0){

		$("param[name=height]").attr("value", 468);

	}

	

	/*
	if($("iframe").length > 0){

		$("iframe").attr("width", 540);

		$("iframe").attr("height", 468);



		$("iframe").css({

			'width': '540px',

			'height': '468px'

		});
	}		
	*/




	

	if($("#birthday").length > 0){

		// Datepicker

		$('#birthday').datepicker({

			dateFormat: 'yy-mm-dd',

			changeYear: true,

			yearRange: '1950:2000'

		});

	}

	

	if($("#release").length > 0){

		// Datepicker

		$('#release').datepicker({

			dateFormat: 'yy-mm-dd'	

		});

	}

	

	//toggle episodes field for "add title" and "edit title"

	$('select[name=type]').change(function(){

		if($(this).val() == 'tv show')

			$("#episodes_active").css({display: ''});

		else

			$("#episodes_active").css({display: 'none'});

	});

})



var last_recommend = 0;

var last_trailer = 0;



function AddPart(){

	html_code = '<tr class="extra_part">' +

                	'<td colspan="2"><strong>Embed Code:</strong></td>' +

                '</tr>' +

          		'<tr class="extra_part">' +

            		'<td colspan="2"><textarea class="field1" name="parts[]" style="width: 500px; height: 150px;"></textarea></td>' +

          		'</tr>' +

		   		'<tr class="extra_part">' +

            		'<td colspan="2"><img src="'+ HTTP + LAYOUTS +'images/spacer.gif" alt="" height="10" /></td>' +

          		'</tr>';	

		  

	$("#parts_links").before(html_code);

	$('#clear_parts').click(ClearParts);

}



function ClearParts(){

	$(".extra_part").remove();	

}



function QuickSubmit(){

	$("#quick_submit_error").attr("class", "");

	$("#quick_submit_error").html('<img src="' + HTTP + LAYOUTS + 'images/load.gif" border="0" /> Processing...');

	

	var url = $("#frm_quick input[name=url]").val();

	

	$.post(HTTP + 'ajax/?quick_vault_submit', {url:url}, function(response) {

		update = response.split("|||");

		if(update[0] == 0){

			$("#quick_submit_error").attr("class", "rederror");

			$("#quick_submit_error").text(update[1]);	

		}

		else{

			$("#frm_quick input[name=url]").val("");

						

			$("#quick_submit_error").attr("class", "greenerror");

			$("#quick_submit_error").text("Video successfully added! If it's approved, you will see it on your VideoVault Page");		

		}

	});	

	

	return false;

}



function SearchVault(){

	var keyword = $("#frm_vault input[name=keyword]").val();

	if(keyword == null || keyword == ''){

		alert("Incomplete field!");

		return false;

	}

	

	document.location = HTTP + 'videovault/' + url_encode(keyword) + '/';

	

	return false;

}



function Recommend(){

	$("#modal_error").attr("class", "");

	$("#modal_error").html('<img src="' + HTTP + LAYOUTS + 'images/load.gif" border="0" /> Validating fields...');

			

	var title_id = $("#frm_recommend input[name=title_id]").val();

	var to = $("#frm_recommend input[name=to]").val();

	var subject = $("#frm_recommend input[name=subject]").val();

	var message = $("#frm_recommend textarea[name=message]").val();

	

	if(to == '' || subject == '' || message == ''){

		$("#modal_error").attr("class", "rederror");

		$("#modal_error").text("Incomplete fields!");

		return false;

	}



	$.post(HTTP + 'ajax/?recommend', {title_id:title_id,to:to,subject:subject,message:message}, function(response) {

		update = response.split("|||");

		if(update[0] == 0){

			$("#modal_error").attr("class", "rederror");

			$("#modal_error").text(update[1]);	

		}

		else{

			$("#frm_recommend input[name=to]").val("");

						

			$("#modal_error").attr("class", "greenerror");

			$("#modal_error").text("Message sent!");		

		}

	});	

}



function MarkUnread(){

	message_id = $(this).attr("id").substr(12);

	

	link_text = $(this).text();

	

	if(link_text.indexOf("Unread") != -1)

		var read_type = 1;

	else

		var read_type = 2;

	

	if(!confirm("Are you sure you want to mark this message as unread?"))

		return false;

	

	$.post(HTTP + 'ajax/?mark_unread', {id:message_id}, function(response) {

		if(response == 1){

			if(read_type == 1)

				$(".mark_unread").text('Mark as Read');

			else

				$(".mark_unread").text('Mark as Unread');

		}

		

		//reload trigger

		$('a.mark_unread').click(MarkUnread);	

	});	

}



function DeleteMessage(){

	message_id = $(this).attr("id").substr(15);

	

	if(!confirm("Are you sure you want to delete this message?"))

		return false;

	

	$.post(HTTP + 'ajax/?delete_message', {id:message_id}, function(response) {

		if(response == 1)

			$("#message_container_" + message_id).remove();		

				

		//reload trigger

		$('a.delete_message').click(DeleteMessage);	

	});	

}



function DelMessage(){

	message_id = $(this).attr("id").substr(12);

	

	if(!confirm("Are you sure you want to delete this message?"))

		return false;

	

	$.post(HTTP + 'ajax/?del_message', {id:message_id}, function(response) {

		update = response.split("|||");

		if(update[0] == 1)

			document.location = update[1];

				

	});	

}



function MassDeleteMessages(){

	var message_ids = new Array();

	$("#selectMessages input[@type=checkbox]").each(function(){

		if($(this).attr("checked") == true)

			message_ids.push($(this).val());

	});

	

	message_ids = message_ids.join(",");

	

	if(message_ids == '' || message_ids == null){

		alert("Please select at least one message!");

		return false;

	}

	

	if(!confirm("Are you sure you want to delete these messages?"))

		return false;

		

	$.post(HTTP + 'ajax/?mass_delete_messages', {ids:message_ids}, function(response) {

		//response will return the ids of the users that have been deleted; ids will be used to remove html elements from page;

		update = response.split("|||");

		if(update[0] == 1 && update[1] != '' && update[1] != null){

			message_ids = update[1].split(",");

			for(i = 0; i < message_ids.length; i++)

				$("#message_container_" + message_ids[i]).remove();		

		}

	});

	

}



function SelectMessages(){

	option_value = $(this).val();

	option_value = parseInt(option_value);

	if(option_value == 0)

		return false;

	

	$("#selectMessages input[@type=checkbox]").attr("checked", false);

	

	// 1 - all; 2- none; 3 - read; 4 - unread

	$("#selectMessages input[@type=checkbox]").each(function(){

		switch(option_value){

			case 1:

			  $(this).attr("checked", true);

			  break;

			case 2:

			  $(this).attr("checked", false);

			  break;

			case 3:

			  checkbox_class = $(this).attr("class");

			  if(checkbox_class.length > 0)

			  	 $(this).attr("checked", true);

			  break;

			case 4:

			   checkbox_class = $(this).attr("class");

			   if(checkbox_class.length == 0)

			   	 $(this).attr("checked", true);

			  break;  

			default:

		  	  $(this).attr("checked", true);

			  break;

		}

	});

}



var receiver_id = 0;



function SendMessage(){

	$("#modal_error").text("");

	

	var to = $("#frm_compose input[name=to]").val();

	var subject = $("#frm_compose input[name=subject]").val();

	var message = $("#frm_compose textarea[name=message]").val();

	

	if(to == '' || subject == '' || message == ''){

		$("#modal_error").attr("class", "rederror");

		$("#modal_error").text("Incomplete fields!");

		return false;

	}



	$.post(HTTP + 'ajax/?send_message', {to:to,subject:subject,message:message}, function(response) {

		update = response.split("|||");

		if(update[0] == 0){

			$("#modal_error").attr("class", "rederror");

			$("#modal_error").text(update[1]);	

		}

		else{

			$("#frm_compose input[name=subject]").val("");

			$("#frm_compose textarea[name=message]").val("");

			

			$("#modal_error").attr("class", "greenerror");

			$("#modal_error").text("Message sent!");		

		}

	});



}



function RemoveFavorite(){

	var favorite_id = $(this).attr("id").substr(9);

	

	if(!confirm("Are you sure you want to this title from your favorites?"))

		return false;

	

	$.post(HTTP + 'ajax/?remove_favorite', {id:favorite_id}, function(response) {

		if(response == 1)

			$("#movie-item-" + favorite_id).remove();

		$(".remove_favorite").click(RemoveFavorite);

	});

}



function Favorites(){

	var title_id = $(this).attr("id").substr(9);

	

	$.post(HTTP + 'ajax/?change_favorite', {title_id:title_id}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			if(update[1] == 0) //favorite removed

				$("#container-favorite-" + title_id).html('<img src="' + HTTP + LAYOUTS + 'images/favorite_out.gif" alt="Favorite" /> <a href="javascript: void(0);" class="favorites" id="favorite_' + title_id + '">Add to favorites</a>');	

			else

				$("#container-favorite-" + title_id).html('<img src="' + HTTP + LAYOUTS + 'images/favorite.gif" alt="Favorite" /> <a href="javascript: void(0);" class="favorites" id="favorite_' + title_id + '">Remove favorite</a>');	

			

		}

		$(".favorites").click(Favorites);

	});

}



function DeclineFriend(){

	var friend_id = $(this).attr("id").substr(15);

	

	if(!confirm("Are you sure you want to decline this friend request?"))

		return false;

	

	$.post(HTTP + 'ajax/?decline_friend', {id:friend_id}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			$("#friend-item-" + friend_id).remove();			

		}

		$(".decline_friend").click(DeclineFriend);

	});

}



function AcceptFriend(){

	var friend_id = $(this).attr("id").substr(14);

	

	if(!confirm("Are you sure you want to accept this friend request?"))

		return false;

	

	$.post(HTTP + 'ajax/?add_friend', {id:friend_id}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			$("#friend-item-" + friend_id).remove();			

		}

		$(".accept_friend").click(AcceptFriend);

	});

}



function AddFriend(){

	var friend_id = $(this).attr("id").substr(11);

	

	if($(this).attr("class").indexOf("blue2") != -1)

		var link_class = 'blue2 add_friend';

	else

		var link_class = 'add_friend';

	

	container = $("#container-friend-" + friend_id).html();

	

	if(container.indexOf('add.png') != -1)

		question = 'Are you sure you want to add this user as friend?';

	else

		question = 'Are you sure you want to remove this user from your list of friends?';

	

	if(!confirm(question))

		return false;

	

	$.post(HTTP + 'ajax/?add_friend', {id:friend_id}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			if(update[1] == 0) //favorite removed

				$("#container-friend-" + friend_id).html('<img src="' + HTTP + LAYOUTS + 'images/remove.png" alt="Friend" /> <a href="javascript: void(0);" class="' + link_class + '" id="add_friend_' + friend_id + '">Remove Friend</a>');	

			else

				$("#container-friend-" + friend_id).html('<img src="' + HTTP + LAYOUTS + 'images/add.png" alt="Friend" /> <a href="javascript: void(0);" class="' + link_class + '" id="add_friend_' + friend_id + '">Add To Friends</a>');	

			

		}

		$(".add_friend").click(AddFriend);

	});

}



function RemoveFriend(){

	var friend_id = $(this).attr("id").substr(14);

	

	var link_class = 'blue2 remove_friend';

	

	if(!confirm("Are you sure you want to remove this friend from your list?"))

		return false;

	

	$.post(HTTP + 'ajax/?add_friend', {id:friend_id}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			$("#friend-item-" + friend_id).remove();

		}

		$(".remove_friend").click(RemoveFriend);

	});

}



function AddComment(){

	var description = $("textarea[name=comment]").val();

	var title_id = $("input[name=title_id]").val();

	

	if(description == null || description == '' || title_id == null || title_id == ''){

		alert('Incomplete field!');

		return false;

	}

	

	$.post(HTTP + 'ajax/?add_comment', {title_id:title_id,description:description}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			if($("#no_comments").length > 0)

				$("#no_comments").remove();

			

			$('#report_error').attr("class", "greenerror");	

			$('#report_error').text('Comment has been posted!');	

			$("#comments").append(update[1]);

			$("textarea[name=comment]").val('');

		}

		else{

			$('#report_error').text(update[1]);	

		}

	});

}



function AddUserComment(){

	var description = $("textarea[name=comment]").val();

	var profile_id = $("input[name=profile_id]").val();

	

	if(description == null || description == '' || profile_id == null || profile_id == ''){

		alert('Incomplete field!');

		return false;

	}

	

	$.post(HTTP + 'ajax/?add_user_comment', {profile_id:profile_id,description:description}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			if($("#no_comments").length > 0)

				$("#no_comments").remove();

			

			$('#report_error').attr("class", "greenerror");	

			$('#report_error').text('Comment has been posted!');	

			$("#comments").append(update[1]);

			$("textarea[name=comment]").val('');

		}

		else{

			$('#report_error').text(update[1]);	

		}

	});

}



function ToggleReport(){

	$('#report_video').toggle(500);	

}



function SendVideoReport(){

	var reason = $("textarea[name=reason]").val();

	var rec_challenge = $("input[name=recaptcha_challenge_field]").val();

	var rec_response = $("input[name=recaptcha_response_field]").val();

	

	if(reason == null || reason == '' || rec_challenge == null || rec_challenge == '' || rec_response == null || rec_response == ''){

		alert('Incomplete field!');

		return false;

	}

	

	var strHref = window.location.href;

	

	$.post(HTTP + 'ajax/?send_video_report', {reason:reason,recaptcha_challenge_field:rec_challenge,recaptcha_response_field:rec_response,href:strHref}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			$('#report_error').attr("class", "greenerror");	

			$('#report_error').text('Report sent!');	

			$('#report_video').toggle(1000);	

			$("textarea[name=reason]").val();

		}

		else{

			$('#report_error').text(update[1]);	

			Recaptcha.reload();

		}

	});

}



function HomeRequest(){

	var name_text = $("input[name=name]").val();

	var url = $("input[name=url]").val();

	var code = $("input[name=code]").val();	

	

	if(name_text == null || name_text == '' || code == null || code == ''){

		alert("Incomplete fields!");

		return false;

	}

	

	$.post(HTTP + 'ajax/?home_request', {name:name_text,url:url,code:code}, function(response) {

		var update = response.split("|||");

		if(update[0] == 1){

			$('#request_error').attr("class", "greenerror");	

			$('#request_error').text('Request sent!');	

		}

		else{

			$('#request_error').attr("class", "rederror");	

			$('#request_error').text(update[1]);	

		}

	});

}



function url_encode(string)

{

	var string;

	var safechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/-_.&?=";

	var hex = "0123456789ABCDEF";

	var encoded_string = "";

	for(var i = 0; i < string.length; i++){

		var character = string.charAt(i);

		if(character == " "){

			encoded_string += "+";

		}else if(safechars.indexOf(character) != -1){

			encoded_string += character;

		}else{

			var hexchar = character.charCodeAt(0);

			if(hexchar > 255){

				encoded_string += "+";

			}else{

				encoded_string += "%";

				encoded_string += hex.charAt((hexchar >> 4) & 0xF);

				encoded_string += hex.charAt(hexchar & 0xF);

			}

		}

	}

	return encoded_string;

}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
