	// click the sub nav 
	function fetchContent(item, section, page) {
		$('#FilterHeader').empty().html('<div style="width:100%; padding-top:25px; padding-bottom:32px;" align="center" ><img src="includes/css/images/loading.gif" /></div>');
		$.post("./index.php?action=fetch_header&controller=SearchMonitor", {section: section},
			function(header) {
			$.post("./index.php?action=fetch_content&controller=SearchMonitor", {item: item, section: section, page: page},
				function(data) {
					$('#FilterHeader').empty().html(header).show();
					$("#CLIPS").html(data);
					if(window.highlight_all) { highlight_all(); }
					if(window.markDays) { markDays(); }
					if(window.markSort) { markSort(); }
					if(window.markFileType) { markFileType(); }
					$(".ClipsContainer").hide(); //temporary fix
					$(".Change_style").fadeIn("fast");
				});
			});
		
	}
	function fetchPurchase(item, section, page) {
		$('#FilterHeader').hide().empty();
		$("#CLIPS").empty().html('<center><br /><br /> <br />Purchase History Will be Loaded HERE!!!</center>');
		$(".Change_style").fadeOut("slow");	
	}
	
/*
	function hideOrShowOutputDiv(TabLabel) {
		if (TabLabel != "tab_stores") {
			$('#tab_stores').hide();
		}
		if (TabLabel != "tab_keywords") {
			$('#tab_keywords').hide();
		}
		if (TabLabel != "tab_cats") {
			$('#tab_cats').hide();
		} 
		if (TabLabel != "tab_Purchase") {
			$('#tab_Purchase').hide();
		}
		$("#"+TabLabel).show();
	}
*/

	function setSearchDays(section, days, page) {
		$("#CLIPS").empty().html('<div style="width:100%; padding-top:50px;" align="center" ><img src="includes/css/images/loading.gif" /></div>');

		$.post("./index.php?action=fetch_content&controller=SearchMonitor", {item: '', days: days, section: section, page: page},
		function(data) {
			$("#CLIPS").html(data);
            		if(window.highlight_all) { highlight_all(); }
	            	if(window.markDays) { markDays(); }
	            	if(window.markSort) { markSort(); }
	            	if(window.markFileType) { markFileType(); }
		});
	}


	function setSortBy(section, page, sort_clips_by) {
		$("#CLIPS").empty().html('<div style="width:100%; padding-top:50px;" align="center" ><img src="includes/css/images/loading.gif" /></div>');

		$.post("./index.php?action=fetch_content&controller=SearchMonitor", {item: '', section: section, page: page, sort_clips_by: sort_clips_by},
		function(data) {
			$("#CLIPS").html(data);
            		if(window.highlight_all) { highlight_all(); }
	            	if(window.markDays) { markDays(); }
	            	if(window.markSort) { markSort(); }
	            	if(window.markFileType) { markFileType(); }
		});
	}

	function setFilterType(section, page, filetype) {
		$("#CLIPS").empty().html('<div style="width:100%; padding-top:50px;" align="center" ><img src="includes/css/images/loading.gif" /></div>');

		$.post("./index.php?action=fetch_content&controller=SearchMonitor", {item: '', filetype: filetype, section: section, page: page},
		function(data) {
			$("#CLIPS").html(data);
            		if(window.highlight_all) { highlight_all(); }
	            	if(window.markDays) { markDays(); }
	            	if(window.markSort) { markSort(); }
	            	if(window.markFileType) { markFileType(); }
		});

	}

	function setSelect(select_id,value_to_select){
//	alert(select_id+"..."+value_to_select);
		var var_Option=document.getElementById(select_id);
		for(var i=0;i<var_Option.length;i++){
			if (var_Option[i].value==value_to_select)
			{
				var var_Text=var_Option[i].text;
				var_Option[i].selected=true;
			}
		}
	}
	


	function saveStudio(studio_num, div_num, clip) {
		$.post("./index.php?action=save_single_store_prefs&controller=SearchMonitor", {store_num: studio_num,  formtype: 'ajax' },
		function(data) {

			$(document).ready(function() {
			// if not IE (-[1,])
			if (-[1,]){$("#s"+clip).fadeOut(400, function(){$("#r"+clip).fadeIn(400);});}else{$("#s"+clip).hide();$("#r"+clip).show();}
				$.blockUI({
					message: $('div.growlUI'),
					fadeIn: 700,
					fadeOut: 700,
					timeout: 3000,
					showOverlay: false,
					centerY: false,
					css: {
							width: '350px',
							top: '10px',
							left: '',
							right: '10px',
							border: '3px solid #aaa',
							padding: '5px',
							backgroundColor: '#339900',
							'-webkit-border-radius': '10px',
							'-moz-border-radius': '10px',
							opacity: .8,
							color: '#fff'
					}
        			});
				
			});
		});
	}
	
	function removeStudio(studio_num, clip) {
		$.post("./index.php?action=remove_single_store_prefs&controller=SearchMonitor", {store_num: studio_num,  formtype: 'ajax' },
		function(data) {
			
			$(document).ready(function() {
			// If Not IE (-[1,])
			if (-[1,]){$("#r"+clip).fadeOut(400, function(){$("#s"+clip).fadeIn(400);});}else{$("#r"+clip).hide();$("#s"+clip).show();}
				$.blockUI({
					message: '<div class="growlUI"><h1>Success:</h1><h2>Studio Removed!</h2></div>',
					fadeIn: 700,
					fadeOut: 700,
					timeout: 3000,
					showOverlay: false,
					centerY: false,
					css: {
							width: '350px',
							top: '10px',
							left: '',
							right: '10px',
							border: '3px solid #aaa',
							padding: '5px',
							backgroundColor: '#339900',
							'-webkit-border-radius': '10px',
							'-moz-border-radius': '10px',
							opacity: .8,
							color: '#fff'
					}
        			});
				
			});
		});
	}


var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose;



