var ieFix = function (){
	if ((document.all))
	{
		// ******* START: This is to FIX IE6++ drag problem *********	
		$('div.layout').removeAttr("isDraggable");
		$('div.layout').removeAttr("unselectable");
		$('div.content_h').removeAttr("isDraggable");
		$('div.content_h').removeAttr("unselectable");
		// ******* END: This is to FIX IE6++ drag problem *********		
	}

	refreshDiv();
	$("#save_button").fadeIn();
	$("#success_msg").hide();	
};

function removeItem(pId)
{
	$('#'+pId +" div.itemContent").empty();
	//$('#'+pId).hide();
}

function refreshDiv()
{
	
		$('.content_container_h').Sortable({
			accept: 'content_h',
			handle: 'div.itemHeader',
			helperclass: 'helper',
			tolerance: 'pointer',
			onStop: ieFix		
		});
		
}

function expand_sub_nav(pDisplayId, obj, pType)
{
	
	if(pType == "id")
	{
		if($("#" + pDisplayId).css("display") == "none")
		{
			$("#" + pDisplayId).show();
			$("#" + obj).attr("src","../elements/image/member/rounded_sub_nav/btn_collapse.gif");
		}
		else
		{
			$("#" + pDisplayId).hide();
			$("#" + obj).attr("src","../elements/image/member/rounded_sub_nav/btn_expand.gif");
		}
	}else{
		if($("#" + pDisplayId).css("display") == "none")
		{
			$("#" + pDisplayId).show();
			$(obj).children("img").attr("src","../elements/image/member/rounded_sub_nav/btn_collapse.gif");
		}
		else
		{
			$("#" + pDisplayId).hide();
			$(obj).children("img").attr("src","../elements/image/member/rounded_sub_nav/btn_expand.gif");
		}
	}
}

function build_item(pId)
{
	var data, url;	
	url = arrItem[pId]["url"];
	data = arrItem[pId]["data"];

	$.ajax({
		type: "POST",
		url: url,
		data: data,
		dataType: "html",
		async: true, /* <-- this to  simultaenously load all ajax at once */
		beforeSend: function(){
			$('#' + pId + " div.itemContent").empty();
			$('#' + pId + " div.itemContent").append('<div style="text-align:center;height:65px;padding-top:21px;"><img src="../elements/image/icon/loader.gif" width="32" height="32" style="vertical-align:middle;" /></div>');
		},
		success: function(data){
			$('#' + pId + " div.itemContent").html(data);
			
			// ******* START: This is to FIX IE6++ drag problem *********	
			$('div.layout').removeAttr("isDraggable");
			$('div.layout').removeAttr("unselectable");
			$('div.content_h').removeAttr("isDraggable");
			$('div.content_h').removeAttr("unselectable");
			// ******* END: This is to FIX IE6++ drag problem *********	
			
		},
		complete: function(){
			return false;
		}
	});
}

function save_setting(pId)
{
	var data, url;	

	url = "ps_home_page_setting_edit.php";
	data = "uName=" + pId;
	data += "&uValue=" + $("#txt_" + pId).val();
	
	arrItem[pId]["data"] = "uLimit=" + $("#txt_" + pId).val();

	$.ajax({
			type: "POST",
			url: url,
			data: data,
			dataType: "html",
			async: false,
			beforeSend: function(){
			},
			success: function(data){
				build_item(pId);
			},
			complete: function(){
				return false;
			}
	});
}

function save_layout()
{
	var data, url;	
	var strTemp;
	strTemp = $("#home_layout").html();

	$("#temp_layout").html(strTemp);
	$("#temp_layout div.content_h div.itemContent").html("");
	$("#temp_layout div.itemHeader").html("");
	
	url = "ps_home_page_edit.php";
	data = "txtContent=" + $("#temp_layout").html();
	//alert(data);
	$.ajax({
			type: "POST",
			url: url,
			data: data,
			dataType: "html",
			async: false,
			beforeSend: function(){

			},
			success: function(data){
				//alert(data);
				$("#temp_layout").empty();
				// ******* START: This is to FIX IE6++ drag problem *********	
				$('div.layout').removeAttr("isDraggable");
				$('div.layout').removeAttr("unselectable");
				$('div.content_h').removeAttr("isDraggable");
				$('div.content_h').removeAttr("unselectable");
				// ******* END: This is to FIX IE6++ drag problem *********	
				refreshDiv();
				$("#success_msg").fadeIn();	
				$("#save_button").hide();
			},
			complete: function(){
				return false;
			}
	});
}

<!--------------------- JAVASCRIPT : ITEM 7 QUICK LINK : START ------------------------------------------------------------------------>
function save_link()
{
	if ($("#txtLinkTitle").val() =="" && typeof($("#txtLinkTitle").val())!="undefined" ){
			
	}else{
			var data, url;	
		
			url = "ps_bookmark_add.php";
			data = "txtLinkTitle=" + $("#txtLinkTitle").val();
			data += "&txtLinkUrl=" + $("#txtLinkUrl").val();
			
			//alert(data);
		
			$.ajax({
					type: "POST",
					url: url,
					data: data,
					dataType: "html",
					async: false,
					beforeSend: function(){
						//alert("Data Save!! " + data);
					},
					success: function(data){
						//alert("Data Save!! " + data);
						build_item("item7");
					},
					complete: function(){
						return false;
					}
			});
	}
}

function delete_link(pId)
{
	$("#li_"+pId).fadeOut(500,function(){
		$("#li_"+pId).empty();							   
	});
	$("#li_"+pId).slideUp(200,function(){
	 	var data, url;
		url = "ps_bookmark_delete.php";
		data = "uCode=" + pId;
		$.ajax({
				type: "POST",
				url: url,
				data: data,
				dataType: "html",
				async: false,
				beforeSend: function(){
				},
				success: function(data){
					save_setting("item7");
				},
				complete: function(){
					return false;
				}
		});	
	}); 
}

<!--------------------- JAVASCRIPT : ITEM 7 QUICK LINK : END ------------------------------------------------------------------------>

<!--------------------- JAVASCRIPT : ITEM 6 MAP SEARCH : START ---------------------------------------------------------------------->
var vType = '2';

function search_bus_map()
{
	window.location = "../home/map_section.php?uTab=1&uFrom=" + $("#startName_bus").val() + "&uTo=" + $("#endName_bus").val() + "&uType=" + $("#routeType").val();
}

function search_bus_type()
{
	//alert("map_section.php?uTab=1&uType=" + vType + "&uKeyword=" + $("#txtBusSearch").val());
	window.location = "../home/map_section.php?uTab=1&uType=" + vType + "&uKeyword=" + $("#txtBusSearch").val();
}

function switchSearch(pIndex)
{
	 vType = pIndex;
}
<!--------------------- JAVASCRIPT : ITEM 6 MAP SEARCH : END ------------------------------------------------------------------------>


