// JavaScript Documentfunction outputlink( str1, str2, str3, str4 ) {	document.write("<a href=" + "mai" + "lto:" + str1 + str2 + str3 + ">" + str4 + "</a>");}function show_popup( content, title, callback ) {	//	if( $('#popup_content') ) { //		$('#dialog').dialog('destroy');//		$('#dialog').remove();//	}//	//	$("<div>").attr('id','dialog').appendTo($(document));//	$("<div>").attr('id','popup_content').appendTo( $('#dialog') ).html( content );	$("body").append("<div id='dialog'></div>");	var btns;	if (callback != 'NONE') { 		if (callback != 'NULL') { 			btns = { 				"Ok": function() { 					eval( callback ); 					$(this).dialog('destroy'); 					$('#dialog').remove(); 				},  				"Cancel" : function() { 					$(this).dialog('destroy'); 					$('#dialog').remove(); 				} 			};		} else {			btns = { 				"Cancel" : function() { 					$(this).dialog('destroy'); 					$('#dialog').remove(); 				} 			};		}	}	$("#dialog").dialog({		bgiframe: true,		width: 670,		height: 550,		modal: true,		title: title,		buttons: btns,		close: function() {			$(this).dialog('destroy');			$('#dialog').remove();		}	});}function validateUser() {	var ret = true;	var returnstr = '';	$("input[required='true']").each( function(el) {		if ( $(this).val() == '' ) { 			ret = false;			returnstr += "\n\rPlease fill in "+this.name;		}	} );	if ( ret ) $('#userForm').submit();	else alert( returnstr );}function validateMedia() {	$("#editmedia").submit();}function delUser( id ) {	if ( confirm( "Permanently Delete this User. Confirm?" ) ) {		window.location.href = 'adminuser.php?action=deluser&id='+id;	}}function checkUsername() {	if ( $('#username_field').val() != '' ) {		$('#checkText').text("Checking ... ");		$.ajax( {			type: 'post',			url: 'ajax_fns.php',			data: "action=usernameCheck&username="+$('#username_field').val(),			success: function(msg) {				$('#checkBtn').removeClass('ui-icon-help');				$('#checkBtn').removeClass('ui-icon-check');				$('#checkBtn').removeClass('ui-icon-notice');				if ( msg == '0' ) {					$('#checkBtn').addClass('ui-icon-notice');				} else {					$('#checkBtn').addClass('ui-icon-check');				}				$('#checkText').text("Check Username");			} 		} );	}}function checkPageName( id ) {	if ( $('#section_name_field').val() != '' ) {		$('#checkText').text("Checking ... ");		$.ajax( {			type: 'post',			url: 'ajax_fns.php',			data: "action=sectionnameCheck&id="+id+"&name="+$('#section_name_field').val(),			success: function(msg) {				$('#checkBtn').removeClass('ui-icon-help');				$('#checkBtn').removeClass('ui-icon-check');				$('#checkBtn').removeClass('ui-icon-notice');				if ( msg == 'bad' ) {					$('#checkBtn').addClass('ui-icon-notice');				} else {					$('#checkBtn').addClass('ui-icon-check');				}				$('#checkText').text("Check Username");			} 		} );	}}function validateSection() {	$("#editSection").submit();}function removeFile( id ) {	if ( confirm( "Delete this file?" ) ) {		$.ajax( {			type: 'post',			url: 'ajax_fns.php',			data: "action=deleteFile&id="+id,			success: function(msg) {				if ( msg == '1' ) {					$('#container_'+id).remove();				}			} 		} );	}}function editFile( id ) {	$.ajax( {		type: 'post',		url: 'ajax_fns.php',		data: "action=editFile&id="+id,		success: function(msg) {			show_popup( msg, "Media File", "" );		} 	} );}function editAttachment( id ) {	$.ajax( {		type: 'post',		url: 'ajax_fns.php',		data: "action=editAttachment&id="+id,		success: function(msg) {			show_popup( msg, "Media Attachment", "" );		} 	} );}function addMediaFile() {	$('#media_item_template').clone().removeClass('hidden').attr('id','').addClass('media_item').appendTo("#newFileContainer");	}///////////////////////////////// CUSTOM FUNCTIONS///////////////////////////////function rotateHeader() {	var current = $("#header .headerImg:visible");	var next = $("#header .headerImg:first");	if ( $("#header .headerImg:visible ~ div").length > 0 ) next = $("#header .headerImg:visible ~ div")[0];	$(current).fadeOut();	$(next).fadeIn();}function showHole( id ) {	$("body").append("<div id='dialog'></div>");	var btns ;	$("#dialog").dialog({		bgiframe: true,		width: 760,		modal: true,		position: ['center',10],		show: "fade",		hide: "fade",		title: "Hole #"+id,		buttons: btns,		close: function() {			$(this).dialog('destroy');			$('#dialog').remove();		}	});	$("#dialog").append( $('#hole'+id+'Cont').clone().css('display','block') );	initPreview();}function initPreview() {	$("#dialog").find(".galThumb").bind('click',function(){		$("#dialog").find('div.galPreview').html( $(this).html() );	});}///////////////////////////////// PERMISSION FUNCTIONS///////////////////////////////	function addPerm( type ) {		if ( type == 'page' || type == 'attachement' ) {			$("#permTemplate").clone().appendTo("#permContainer").css('display','block').attr('id','');		} else {			$("#permTemplateFile").clone().appendTo( $(type).parent().find('div.permFileContainer') ).css('display','block').attr('id','');		}	}	///////////////////////////////// ONLONAD FUNCTIONS///////////////////////////////	$(function() { 		$('.ui-button').live('mouseover', function () { $(this).toggleClass('ui-state-default'); $(this).toggleClass('ui-state-hover'); } );		   		$('.ui-button').live('mouseout', function () { $(this).toggleClass('ui-state-default'); $(this).toggleClass('ui-state-hover'); } );		   		$('.ui-button-sm').live('mouseover', function () { $(this).toggleClass('ui-state-default'); $(this).toggleClass('ui-state-hover'); } );		   		$('.ui-button-sm').live('mouseout', function () { $(this).toggleClass('ui-state-default'); $(this).toggleClass('ui-state-hover'); } );		   		$('#username_field').bind('change', function() { 			$('#checkBtn').removeClass('ui-icon-check');			$('#checkBtn').removeClass('ui-icon-notice');			$('#checkBtn').addClass('ui-icon-help');		} );				$('img.rollover').live('mouseover',function(){ $(this).attr('src', $(this).attr('src').replace( ".", "_on." ) )});		$('img.rollover').live('mouseout',function(){ $(this).attr('src', $(this).attr('src').replace( "_on.", "." ) )});					$('span.rollover').live('mouseover',function(){ $(this).css('background-image', $(this).css('background-image').replace( ".png", "_on.png" ) ); $(this).css('color','#ffffff'); });		$('span.rollover').live('mouseout',function(){ $(this).css('background-image', $(this).css('background-image').replace( "_on.png", ".png" ) ); $(this).css('color','#000000'); });				$("#loginform input").keypress(function (e) {  			if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {  				$('#loginform').submit();				return false;  			} else {  				return true;  			}  		});  		// MENU INIT		$("#menu ul li").each(function() {			var li = $(this);			var on = false;			if ( $(this).find('ul').width() && $(this).find('ul').width() < $(this).outerWidth(true) ) { 				$(this).find('ul').css('width',$(this).outerWidth(true)+'px'); 			}			li.bind('mouseenter',function() {				if ( !on ) {					li.find('ul').slideDown('fast', function(){ on = true; } );					li.css('background','#232323');				}			});			li.bind('mouseleave',function() {				if ( on ) {					li.find('ul').slideUp('fast', function(){ on = false; } );					li.css('background','#000');				} else {					setTimeout( function(){ li.find('ul').slideUp('fast', function(){ on = false; } ); li.css('background','#000'); }, 500 );				}			});		});		setInterval("rotateHeader()",5000);				$("#jQueryAccordion").accordion();		//$('a[rel*=lightbox]').lightBox({maxHeight: 300,maxWidth: 500});		//showHole( '1' );	 } );
