$(document).ready(function(){

$.preloadCssImages();
	$(".cnr").corner('6px');

	if(typeof(loadResults)=='function'){	loadResults(); }

if(typeof(loadRecipients)=='function'){		loadRecipients();}
	if(typeof(loadMap)=='function'){		loadMap();}
	
	if(sessMess.length>0){$.prompt(html_entity_decode(sessMess));}
	//runAds();
	
}); 


function aSk(type,e){
	if(typeof(e)=="string"){ e=unescape(e);	 if(e.substring(0,1)=='{'){e=$.evalJSON(e);}else{e=getFields(e);}}		
//	alert(type+' '+$.toJSON(e));
	
	$.post(type+".php",e,
	function(data){
	
	if(!isNumeric(data) && data.substring(0,1)!="{"){
		$.prompt(data+'<br />',{buttons:{}});
		return false;
	}
	if(data.length>0){data=$.evalJSON(data);}
	if(data['error']){
		$.prompt(html_entity_decode(data['error'])); 
		return false;
	}
	jQuery.prompt.close();
	switch(type){

case "admin/addBirthdayPro"		:
case "checkCur"				: 	
case "admin/addAdPro"				: 	break;
case "sound_engineerConfirm":	 $('#req'+e['id']).css('display','none'); 										break;
case "arGig2_2": 				$.prompt("Request Sent.",{timeout:1000});										break;
case "arGig3":  				$('#req'+e['id']).css('display','none');
								$.prompt("The Gig Has Been Confirmed.",{timeout:1000});							break;	//WORKS	
case "arGig1_2":  				$.prompt("A request has been sent to the relevant profiles.",{timeout:1200});	break;	//WORKS
case "notifyAttendeesPro":		$.prompt('Notification Sent',{timeout:1000});									break;	//WORKS
case "requestReplyProcess": 	$.prompt("Action Successful",{timeout:1000});	checkCuteyRem();	break;	//checkstockonly for request decline page		
case "gigsWallWritePro": 		$.prompt("Action Successful",{timeout:1000});									break;	//WORKS		
case "gigsTicketLinkPro": 		$.prompt("Action Successful",{timeout:1000});									break;	//WORKS		
case "reportClosure":			$.prompt("Thanks, we'll look into the status of this company and remove the profile if it appears that they are no longer in business",{timeout:3000});break;	
case "sendLoginPro"	:			$.prompt('You Have Email',{timeout:1000});										break;
case"inviteMember":
case"vInviteP":
case"eventInvite":
case"applyToPlay":				aSk("requestReply",data); break;	//WORKS
case "arGig2_3":
case"vInvitePAccept":
case"memberAccept":
case"applyToPlayConfirm":
case"contactConfirm":
case"claimGigApprove":			$('#req'+e['id']).css('display','none'); 
								aSk("requestReply",data); break;	//WORKS
case "myCalendarAdd": 			$('#req'+e['reqDelId']).css('display','none'); 
								aSk('selectContacts',data);													break;
case "selectContacts":			aSk('eventInvite',data);													break;
case "myCalCreate":  			aSk('selectContacts',data);													break;
case "contactAdd":				$("#incontacts").html("<a >Contact Requested</a>");	
								aSk("requestReply",data);													break;	//WORKS
case "contactRemove":			$("#incontacts").html("<a >Contact Removed</a>"); 
								$("#con"+e['id']).css('display','none'); 
								enable();																	break;	//WORKS
case "claimGigRequest":			$('#cl'+e['gid']).css('display','none'); 
								aSk("requestReply",data); 													break;	//WORKS
case "newslistAdd": 			$("#innewslist").html('<a href=\'#\'onclick=\'aSk("newslistRemove",'+$.toJSON(e)+');  return false;\'>Remove from News</a>');	
								enable();																	break;//WORKS	
case "newslistRemove": 			$("#innewslist").html('<a href=\'#\' onclick=\'aSk("newslistAdd",'+$.toJSON(e)+');  return false;\'>Add to News List</a>');	
								enable();																	break;//WORKS	
case "gigs_PofV":				ask(data['type']);  
								enable();								 									break;//very clever function, if retrows <1 dont disaply page, just send var back
case "gigs_VofP":				ask(data['type']);  
								enable();								 									break;
case "gigsMyGroups" :			setPoster(data);															break;
case "gigsMakeVenuePro"	:		set(data['id'],data['name'],data['type']); 									break;

default:   					alert('default shouldnt see this make the function inside erMsg to handle this TYPE - '+type);
//handled in gigsManage? case "gigsAddBand":  				alert('gigs add band'+data);								 					break;//very clever function, if retrows <1 dont disaply page, just send var back
//CHECK STOICK AND CUTEYREM STOP ERMSG AS PAGE RELOADS. HOW STOP THIS
//}
return true;
	}});
}	


function parse_date(
	timestamp) {  
	if(timestamp.length==10){timestamp+=' 00:00:00'}
    var date = new Date();  
    var parts = String(timestamp).split(/[- :]/);  
    date.setFullYear(parts[0]);  
    date.setMonth(parts[1] - 1);  
    date.setDate(parts[2]);  
    date.setHours(parts[3]);  
    date.setMinutes(parts[4]);  
	date.setSeconds(parts[5]);  
    date.setMilliseconds(0);  
   	return date;  
}  


function mysqlJsDate(timestamp) {
	if(timestamp.length==10){timestamp+=' 00:00:00'}
    //function parses mysql datetime string and returns javascript Date object
    //input has to be in this format: 2007-06-05 15:26:02
    var regex=/^([0-9]{2,4})-([0-1][0-9])-([0-3][0-9]) (?:([0-2][0-9]):([0-5][0-9]):([0-5][0-9]))?$/;
    var parts=timestamp.replace(regex,"$1 $2 $3 $4 $5 $6").split(' ');
    return new Date(parts[0],parts[1]-1,parts[2],parts[3],parts[4],parts[5]);
}
  

function clearUp(tagId) {var f=$('#'+tagId).html($('#'+tagId).html());} 

  
function stripHTML(oldString) {
	var newString = "";
	var inTag = false;
	for(var i = 0; i < oldString.length; i++) {
		if(oldString.charAt(i) == '<') inTag = true;
		if(oldString.charAt(i) == '>') {
           	if(oldString.charAt(i+1)=="<"){
           		//dont do anything
			}else{
				inTag = false;
				i++;
			}
        }
 		if(!inTag) newString += oldString.charAt(i);
   	}
   return newString;
}


function delProfile(id){
	var response = window.confirm("Are you sure you want to remove this profile?");
	if (response) {
	disable();
	$.post("admin/manageDelProfile.php",{id:id},
  	function(data){
	if(data.length<1){window.location="admin/accountmanager.php";}else{$.prompt(data);}
	enable();
});}}
	




//function checkFunctions(){}


function runAds(){
	//ads=$.evalJSON(theAds);
//alert('kkk');
var b=new Array();

	$(".cleverAdBox").each(		
	function(i){
		b[i]=new Array();
		var parentId = $(this).parent().get(0).id;
		var h=$("#"+parentId).height();
		var pos = $(this).position();
		var clear=$("#"+parentId).nextAll('.clear').position();
		b[i][0]=$(this).width();
		b[i][1]=(clear.top-pos.top-15);
	});

	$(".hidAd").each(		
	function(){
		if(typeof(c)=='undefined'){var c=b.length;}
		b[c]=new Array();
		b[c][0]=$(this).width();
		b[c][1]=$(this).height();
		c++;
	});
	
	//alert(b[1][0])
	$.post("adsRetrieve.php",{'theAds':theAds,'dim':$.toJSON(b)},
	function(data){
		//alert(data);
		//if(!isNumeric(data) && data.substring(0,1)!="{"){





if(data.substring(0,1)!="[" && data.substring(0,1)!="{"){
		$.prompt('pre'+data,{buttons:{}});
		return false;
		}else{
		//alert(data);
		data=$.evalJSON(data);
		
		c=0;
$(".cleverAdBox").each(		
	function(i){
		$(this).html(data[i]+'<br/><br/>');
	c++;
	});
$(".hidAd").each(		
	function(i){
		$(this).html(data[c]+'<br/><br/>');
	c++;
	});
		//alert(data[i]);
		}
		
	});
/*	
	
	if(typeof(ads)!='object'){return false;}
	
	var adColumn=new Array();
	var box=new Array();
	
$(".cleverAdBox").each(		
	function(i){
		adColumn[(i+1)]=new Array();
		var parentId = $(this).parent().get(0).id;
		var h=$("#"+parentId).height();
		var pos = $(this).position();
		var clear=$("#"+parentId).nextAll('.clear').position();
		adColumn[(i+1)]['adW']=$(this).width();
		adColumn[(i+1)]['adH']=(clear.top-pos.top-15);
		$(this).css("height",adColumn[(i+1)]['adH']);
		adColumn[(i+1)]['this']=this;
		$(adColumn[(i+1)]['this']).html(adColumn[(i+1)]['adH']+'<br/>');
	});

	var col=1;	
	var i=0;
	var strikeNo=1;
	var end=0;

	while(end<1){
		bw=adColumn[col]['adW'];
		bh=adColumn[col]['adH'];
		aw=ads[i][0];
		ah=ads[i][1];
		//alert(ads[i][3]+' '+aw+'x'+ah+' st-'+strikeNo)
		if(bh>ah && (aw<=bw && aw> (bw-100) )){
			$(adColumn[col]['this']).html($(adColumn[col]['this']).html()+decodeURIComponent(ads[i][2])+'<br /><br />');
			adColumn[col]['adH']=(bh-ah-20);			
			strikeNo=1;
			i++;
		}else{
			//$(adColumn[col]['this']).html($(adColumn[col]['this']).html()+'<br />'+ads[i][3]+' ad-'+aw+'x'+ah+' i='+i+'<br />box'+bw+'x'+bh+' i='+i+'<br />');
			strikeNo++;
		}
		if(strikeNo>=adColumn.length){i++;strikeNo=1;}
		col++;
	if(i==ads.length){end++;}
	if(col==adColumn.length){ col=1;}	}	
*/
}



profileTypes=["band","booking_agent","light_engineer","manager","music_lawyer","music_shop","music_tutor","promoter","photographer","practise_room","publisher","sleeve_artist","sound_engineer","member","venue"];

function checkCuteyRem(){if(typeof(cuteyRem)=='number'){cuteyRem--;	checkstock();}}
function checkstock(){	if(cuteyRem<2){window.location.reload();}else{enable();}}
function addslashes(str) {str=str.replace(/\'/g,'\\\'');str=str.replace(/\"/g,'\\"');str=str.replace(/\\/g,'\\\\');str=str.replace(/\0/g,'\\0');return str;}
function stripslashes(str) {str=str.replace(/\\'/g,'\'');str=str.replace(/\\"/g,'"');str=str.replace(/\\\\/g,'\\');str=str.replace(/\\0/g,'\0');return str;}
function ucwords(str){return (str+'').replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase ( ); } );}
function highlight(str,key) {var words=str.split(' ');var out='';for (var b=0; b<words.length; b++){if(words[b].replace (/[\.\,\?!\s]/g, "").toLowerCase() ==key.toLowerCase() ){out+="<b  class='red'>"+words[b]+'</b> ';}else{out+=words[b]+' ';}}return out;}
function page(){if(document.forms['searchForm'] && document.forms['searchForm'].elements['pagenum']){document.forms['searchForm'].elements['pagenum'].value=1;}}
function ret(i,ret){if ((i % ret == 0) && (i>0)) {return'<div class="clear"></div>';}else{return "";}}


function addTableRow(jQtable,e){
	var table = document.getElementById(jQtable);
	var rowCount = table.rows.length;
	var row = table.insertRow(rowCount);
	for(var i in e){
    	var cell1 = row.insertCell(i);
		cell1.innerHTML=e[i];
    }
}

function nl2br (str, is_xhtml) {
	var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '' : '<br>';
    return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
}

function aBox(type,array,button,size){
	var id=array[0];
	var name=array[1];
	var imgid=array[2];
	
	var l='<div class="membersBox '+size+'">';
	if(button!='' && type!='img'){l+=button+'<br />';}
	if(imgid==''||imgid==null){imgid=0;}
	//alert(root);
	l+='<div class="img D'+type+'"><div style="position:relative;">';//'+root+'
	     if(type=='flyer'){var id=imgid; var page='href="flyerPrint.php?id='+id+'"'; }
	else if(type=='img'){var page='href="#" onclick="'+button+' return false;"';}
	else{var page='href="'+type+'_profile.php?id='+id+'" target="_parent"';}
		if(id>0 ){ l+='<a '+page+'>'; }
		
       	l+='<img src="ups/'+size+'/'+imgid+'.jpg"  alt="'+escape(name)+'">';
    	if(id>0 ){ l+='</a>'; }
		l+='</div>'; 
   if(id>0 ){ l+='<a '+page+'>'; }
	l+=name;
	if(id>0 ){ l+='</a>'; }
	l+='</div></div>';
	//alert(l);
	return l;
}

function sub_genre(){
	var genSel=document.forms["searchForm"]["genre"];
	var subSel=document.forms["searchForm"]["sub_genre"];
	var genre=genSel.value;
	var sub_genre=subSel.value;
	subSel.options.length=0;
	if(genSel.value!=''){
		$(".genTd").css("visibility","visible");
		$.post("sub_genres.php",{o:genSel.value},
  		function(data){
		var a=$.evalJSON(data); 
		if(a.length>0)	{
			subSel.options[0] = new Option('select',"0",false,true);
			for (r=0; r<a.length;r++){
				
				if(sub_genre==a[r]["id"]){		var b=true	}else{var b=false} 
				subSel.options[(r+1)] = new Option(a[r]["sub_genre"],a[r]["id"],false,b); 
			}		
			enable();
		}else{subSel.options[0] = new Option('No Options',0,false,true);  }			
		});
	}else{
		$(".genTd").css("visibility","hidden");
		subSel.value=''; 
	}
}

function in_array(needle, haystack, strict) {
    var found = false, key, strict = !!strict;
 	for (key in haystack) {
    	if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    } 
    return found;
}




function distanceType() {
	$('#postcodeSearch').css("display",'none');
	$('#townSearch').css("display",'none');
	$('#countySearch').css("display",'none');
	
	     if (document.searchForm.distancetype['0'].checked) {$('#postcodeSearch').css("display",'');}
	else if (document.searchForm.distancetype['1'].checked) {$('#townSearch').css("display",'');}
	else if (document.searchForm.distancetype['2'].checked) {$('#countySearch').css("display",'');}
	
}


function getFields(form){
	o= new Object;
	var f=document.forms[form];
	//if(!f){	var f=$("jqi").document.forms[form];}
	if(!f){alert("no f"); return false;}
	var backup=new Array();
	for (var i=0; i<f.elements.length; i++){
		var name=f.elements[i].name;
		var type=f.elements[i].type;
		//alert(name+' - '+type);
		if(type=='radio'){
			if(f.elements[i].checked){	o[name]=f.elements[i].value; }
		}else if(type=='checkbox'){
			backup[backup.length]=name;
			if(f.elements[i].checked){
				if(!o[name]){o[name]=new Array();  	}
				o[name][o[name].length]=f.elements[i].value;
			}
		}
		else{			o[name]=f.elements[i].value; }
	}
	for(var e in backup){if(!o[backup[e]]){o[backup[e]]=0;}}
	return o;
}

function switchContact(dir,id){
	
	var cons=$("#cons").html();
	 cons=$.evalJSON(cons);
	if(dir<1){cons[id][1]=0;}else{cons[id][1]=1;}
	var inhtm="";
	var notinhtm="";
	
	$("#cons").html($.toJSON(cons));
	isin=new Array;
	for(var i in cons){
		if(cons[i][1]>0){
			inhtm+='<a href="#" onclick="switchContact(0,'+i+'); return false;">'+cons[i][0]+'</a><br />';
			isin[isin.length]=i;
		}else{
			notinhtm+='<a href="#" onclick="switchContact(1,'+i+'); return false;">'+cons[i][0]+'</a><br /';	
		}
	}
	$("#in").html(inhtm);
	$("#notIn").html(notinhtm);
	$("#isin").html($.toJSON(isin));
}






function resize(id){
	window.top.$('#'+id).css("height",0+'px');
	window.top.$('#'+id).css("display",'block');
	var h=window.top.document.getElementById(id).contentWindow.document.body.scrollHeight;
	window.top.$('#'+id).css("height",window.top.document.getElementById(id).contentWindow.document.body.scrollHeight+'px');
}
function enable(){
	$('#errorMessage').css('display','none'); $('#blanket').css("display",'none'); 
//	if(parent.document.forms[0]){parent.document.forms[0].elements[0].focus();}
}
function disable(){window.top.$("#blanket").css("display",'block');}


function cancelEvent(id,et){
	var mush=window.confirm("are you sure you want to cancel this event?");
	if(!mush){return false;}
	disable();
	$.post("calendarCancel.php",{id:id,et:et},
  	function(data){
	if(data.length<1)	{$.prompt("Event Cancelled",{timeout:1000}); $('#'+et+id).css("display","none");}else{$.prompt(data);}
	enable();	
});}


function changeRating(id,rating){
	disable();
	$.post("ratingchange.php",{id:id,rating:rating},
  	function(data){
	if(data.length<1)	{$.prompt("Rating ammended",{timeout:1000});	}else{$.prompt(data);}
	enable();	
});}






	



function htmlentities(texto){
    var i,carac,letra,novo='';
    for(i=0;i<texto.length;i++){
        carac = texto[i].charCodeAt(0);
        if( (carac > 47 && carac < 58) || (carac > 62 && carac < 127) ){
          //se for numero ou letra normal
            novo += texto[i];
        }else{
            novo += "&#" + carac + ";";
        }
    }
    return novo;
}

function html_entity_decode(str) {
  var ta = document.createElement("textarea");
  ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
  toReturn = ta.value;
  ta = null;
  return toReturn
} 


function closeComment(){$('#commentBox').css("display","none");}
function leaveComment(id,t){
	if(document.getElementById("com")){var com=$("#com").html();}else{var com="";}//.replace(/\r\nŠ\n/g,"<br />").replace(/\s/g,"&nbsp;")
	$("#commentBox").css("display","block");
	var p1='<textarea id="theComment" style="width:668px; height:100px; margin-left:5px; backround:#cecece;">'+com.replace(/<br>/g,'\n')+'</textarea>';
	var p2='<input type="button" onclick="previewComment('+id+','+t+'); return false;" value="Preview" class="btn"><div class="clear"></div>';
	$("#commentContent").html(p1+p2); 
}
function previewComment(id,t){
	if($("#theComment").val()==''){alert("you need to write a comment"); return false;}
	var p1='Below is a display of how you comment will look once posted, check it and edit if necessary. Otherwise click submit.<br />';
	var p2='<p id="comMsg" style="color:red;"></p><div class="underline"></div>';
	var p3='<div style="margin-left:49px;" class="commentText" id="com" >'+$("#theComment").val().replace(/\n\r?/g, '<br>')+'</div>';
	var p4='<div class="underline"></div><input type="button" onclick="leaveComment('+id+','+t+'); return false;" value="Edit" class="btn">';
	var p5='<input type="button" onclick="submitComment('+id+','+t+'); return false;\" value="post"  class="btn"><div class="clear" ></div>';
	$("#commentContent").html(p1+p2+p3+p4+p5); 
}

function submitComment(id,t){
if($('#com').html()==''){$('#comMsg').html('you need to write something into the comment box');}
else {
	disable();
	$.post("leave_comment_process.php",{id:id,t:t,comment:$('#com').html()},
	function(data){
	if(data.length<1)	{
		$('#results').html('<div class="content">'+aBox("member",[activeuserid,decodeURIComponent(activeuser),activeimgid],'','m')+'<p class="black">Just Now</p><br />'+$('#com').html()+'</div><div class="underline"></div>'+ $('#results').html())
		$("#commentBox").css("display","none");
		$("#commentSent").css("display","block");
		
		//tml("<div style='width:400px; height:300px; background:#000000; color:#ffffff'>a big advert</div>");
		//window.location='#comment';
	}else{$('#comMsg').html(data); $.prompt(data);}
	 enable();	
});}}

function isNumeric(sText){
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) { 
   Char = sText.charAt(i); 
   if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   }





// Simulates PHP's date function
Date.prototype.format = function(format) {
	var returnStr = '';
	var replace = Date.replaceChars;
	for (var i = 0; i < format.length; i++) {
		var curChar = format.charAt(i);
		if (replace[curChar]) {
			returnStr += replace[curChar].call(this);
		} else {
			returnStr += curChar;
		}
	}
	return returnStr;
};
Date.replaceChars = {
	shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
	longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
	shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
	longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
	
	// Day
	d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
	D: function() { return Date.replaceChars.shortDays[this.getDay()]; },
	j: function() { return this.getDate(); },
	l: function() { return Date.replaceChars.longDays[this.getDay()]; },
	N: function() { return this.getDay() + 1; },
	S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
	w: function() { return this.getDay(); },
	z: function() { return "Not Yet Supported"; },
	// Week
	W: function() { return "Not Yet Supported"; },
	// Month
	F: function() { return Date.replaceChars.longMonths[this.getMonth()]; },
	m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); },
	M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; },
	n: function() { return this.getMonth() + 1; },
	t: function() { return "Not Yet Supported"; },
	// Year
	L: function() { return (((this.getFullYear()%4==0)&&(this.getFullYear()%100 != 0)) || (this.getFullYear()%400==0)) ? '1' : '0'; },
	o: function() { return "Not Supported"; },
	Y: function() { return this.getFullYear(); },
	y: function() { return ('' + this.getFullYear()).substr(2); },
	// Time
	a: function() { return this.getHours() < 12 ? 'am' : 'pm'; },
	A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; },
	B: function() { return "Not Yet Supported"; },
	g: function() { return this.getHours() % 12 || 12; },
	G: function() { return this.getHours(); },
	h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); },
	H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
	i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
	s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
	// Timezone
	e: function() { return "Not Yet Supported"; },
	I: function() { return "Not Supported"; },
	O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; },
	P: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':' + (Math.abs(this.getTimezoneOffset() % 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() % 60)); },
	T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;},
	Z: function() { return -this.getTimezoneOffset() * 60; },
	// Full Date/Time
	c: function() { return this.format("Y-m-d") + "T" + this.format("H:i:sP"); },
	r: function() { return this.toString(); },
	U: function() { return this.getTime() / 1000; }
};