<!--
function createRequest(){
	try{
			request=new XMLHttpRequest();
	}catch (trymicrosoft){
		try{
				request=new ActiveXObject("Msxm12.XMLHTTP");
		}catch(othermicrosoft){
			try{
					request = new ActiveXObject("Microsoft.XMLHTTP");
		 	}catch(failed){
					request=null;
			}
		}
	}
	if (request==null){
		alert("Error creating request Object!");
	}else{
		return request;
	}
}
var requestItemDetail = createRequest();
function displayItemDetail(itemId) {
	var url="item-detail.php?Item_Id="+itemId;
	url = url + "&dummy=" + new Date().getTime();
	requestItemDetail.open("GET",url,true);
	requestItemDetail.onreadystatechange=displayItemDetail_callback;
	requestItemDetail.send(null);
}
function displayItemDetail_callback(){
	if (requestItemDetail.readyState==4){
		if (requestItemDetail.status==200){
			document.getElementById("divItemDetail").innerHTML = requestItemDetail.responseText;
		}
	}
}

var requestImageNewProduct = createRequest();
function LoadImageNewProduct(itemId){
	var url="imageNewProduct.php?Item_Id="+itemId;
	url = url + "&dummy=" + new Date().getTime();
	requestImageNewProduct.open("GET",url,true);
	requestImageNewProduct.onreadystatechange=LoadImageNewProduct_callback;
	requestImageNewProduct.send(null);
}
function LoadImageNewProduct_callback(){
	if (requestImageNewProduct.readyState==4){
		if (requestImageNewProduct.status==200){
			document.getElementById("divImageNewProduct").innerHTML = requestImageNewProduct.responseText;
		}
	}
}

function insertParam(key, value) 
{ 
    key = escape(key); value = escape(value); 
    var kvp = document.location.search.substr(1).split('&'); 
    var i=kvp.length; var x; while(i--)  
    { 
        x = kvp[i].split('='); 
        if (x[0]==key) 
        { 
                x[1] = value; 
                kvp[i] = x.join('='); 
                break; 
        } 
    } 
 
    if(i<0) {kvp[kvp.length] = [key,value].join('=');} 

    //this will reload the page, it's likely better to store this until finished 
    document.location.search = kvp.join('&');  
} 

function getInsertParam(url, key, value){ 
    key = escape(key); value = escape(value); 
	//var kvp = document.location.search.substr(1).split('&'); 
	var kvp = url.substr(0).split('&'); 
    var i=kvp.length; var x; while(i--)  
    { 
        x = kvp[i].split('='); 
        if (x[0]==key) 
        { 
                x[1] = value; 
                kvp[i] = x.join('='); 
                break; 
        } 
    } 
 
    if(i<0) {kvp[kvp.length] = [key,value].join('=');} 
	
	return kvp.join('&');
    
	//this will reload the page, it's likely better to store this until finished 
    //document.location.search = kvp.join('&');  
}

function insertParam_Modified(url, key, value) 
{ 
    key = escape(key); value = escape(value); 
    var kvp = url.substr(1).split('&'); 
    var i=kvp.length; var x; while(i--)  
    { 
        x = kvp[i].split('='); 
        if (x[0]==key) 
        { 
                x[1] = value; 
                kvp[i] = x.join('='); 
                break; 
        } 
    } 
 
    if(i<0) {kvp[kvp.length] = [key,value].join('=');} 

    //this will reload the page, it's likely better to store this until finished 
    document.location.search = kvp.join('&');  
} 

function PopupWindow(url, width , height){
	var leftVal = (screen.width - width) / 2;
	var topVal = (screen.height - height) / 2;
	var sFeature = "top=" + topVal + ",left=" + leftVal + ",width=" + width + ",height=" + height + ",toolbar=yes,resizable=yes,scrollbars=yes,status=yes"
	window.open(url, 'popup', sFeature); 
}
function EnlargeImage(url,w,h){
	window.open (url,'Image','location=0,status=0,scrollbars=1,resizable=1,width='+w+',height='+h);
}
function checkNull(txtBox,msg){
	var txtBox;
	if (txtBox.value == ''){
		alert(msg);
		txtBox.focus();
		return false;
	}else{
		return true;
	}
}
function addToCart(catalog_id, category_id, start, no, prd_id, qty, unit_price, phpsess_id){
	if (phpsess_id != ''){
		if (qty == '' || qty == 0 || qty < 0){
			alert('Please enter at least 1 of Qty Needed.');
			return false;
		}
		//window.location = 'add_to_cart_action.php?catalog_id='+catalog_id+'&category_id='+category_id+'&start='+start+'&no='+no+'&prd_id='+prd_id+'&qty='+qty+'&unit_price='+unit_price+'&PHPSESSID='+phpsess_id;
		document.forms[0].action = 'add_to_cart_action.php?catalog_id='+catalog_id+'&category_id='+category_id+'&start='+start+'&no='+no+'&prd_id='+prd_id+'&qty='+qty+'&unit_price='+unit_price+'&PHPSESSID='+phpsess_id;
		document.forms[0].method = 'post';
		document.forms[0].submit();
		return true;
	}else{
		alert('Please sign in to add items to the cart.');
		return false;
	}
}
function UpdateQtyToCart(catalog_id, category_id, start, no, prd_id, qty, unit_price, phpsess_id){
	if (phpsess_id != ''){
		if (qty == '' || qty < 0){
			alert('Please enter at least 1 of Qty Needed.');
			return false;
		}
		window.location = 'update_to_cart_action.php?catalog_id='+catalog_id+'&category_id='+category_id+'&start='+start+'&no='+no+'&prd_id='+prd_id+'&qty='+qty+'&unit_price='+unit_price+'&PHPSESSID='+phpsess_id;
		//document.forms[0].action = 'update_to_cart_action.php?catalog_id='+catalog_id+'&category_id='+category_id+'&start='+start+'&no='+no+'&prd_id='+prd_id+'&qty='+qty+'&unit_price='+unit_price+'&PHPSESSID='+phpsess_id;
		//document.forms[0].method = 'post';
		//document.forms[0].submit();
		return true;
	}else{
		alert('Please sign in to add items to the cart.');
		return false;
	}
}
function qty_changed(i){
	if (document.getElementById('chk'+i)){
		document.getElementById('chk'+i).checked = true;
	}
	findSelectedItem();
}
function add_qty(txtbox,i){	
	if (document.getElementById(txtbox).value == ''){
		document.getElementById(txtbox).value = 0;
	}
	document.getElementById(txtbox).value = parseInt(document.getElementById(txtbox).value) + 1;
	if (document.getElementById('chk'+i) && document.getElementById(txtbox).value > 0){
		document.getElementById('chk'+i).checked = true;
	}
	findSelectedItem();
}

function less_qty(txtbox,i){
	if (document.getElementById(txtbox).value == ''){
		document.getElementById(txtbox).value = 0;
	}
	var qty = parseInt(document.getElementById(txtbox).value) - 1;
	if (qty == 0){
		if (document.getElementById('chk'+i)){
			document.getElementById('chk'+i).checked = false;
		}
	}
	if (qty < 0){
		alert('The Qty can not be less than 0.');
		document.getElementById(txtbox).value = 0;
	}else{
		document.getElementById(txtbox).value = qty;
	}
	findSelectedItem();
}
function findSelectedItem(){
	if (document.getElementById('hidCount')){
		var noOfChk = document.getElementById('hidCount').value;		
		var selectedCheckbox = 0;
		var str_list;
		if (document.getElementById("txtList")){
			document.getElementById("txtList").value = '';
			for(var i = 0; i <= noOfChk; i++){
				if (document.getElementById('chk'+i).checked == true){
					str_list = document.getElementById('chk'+i).value;
					document.getElementById("txtList").value = document.getElementById("txtList").value + '||' + str_list;
					selectedCheckbox++;
				}
			}
		}
	}
}

function defaultQty(i){
	if (document.getElementById('chk'+i).checked == true){
		document.getElementById('txtQty'+i).value = 1;
	}else{
		document.getElementById('txtQty'+i).value = 0;
	}
}

function addItem(chkbox, txtbox, j){
	findSelectedItem();
	if (chkbox.checked == true){
		txtbox.value = 1;
	}else{
		txtbox.value = 0;
	}
}

function selectAll(){
	var allRowsPerPage = document.getElementById('hidCount').value
	var el;
	var qty;
	// check all
	if (document.getElementById('headChk').checked == true){
		for(var i=0; i<allRowsPerPage; i++){
			el = document.getElementById("chk"+i);
			qty = document.getElementById("txtQty"+i);
			// check only unchecked checkbox
			if (el.checked == false){
				el.checked = true;
				qty.value = 1;
			}
		}
	// Uncheck all
	}else{
		for(var i=0; i<allRowsPerPage; i++){
			el = document.getElementById("chk"+i);
			qty = document.getElementById("txtQty"+i);
			el.checked = false;
			qty.value = 0;
			document.frmAddToCart.txtList.value = '';
		}	
	}
	
	var selectedCheckbox = 0;
	var str_list;
	document.frmAddToCart.txtList.value = '';
	for(var j=0; j<allRowsPerPage; j++){
		el = document.getElementById("chk"+j);
		if (el.checked == true){
			str_list = el.value;
			document.frmAddToCart.txtList.value = document.frmAddToCart.txtList.value + '||' + str_list;
			selectedCheckbox++;
		}
	}
}
function checkout(url){
	if (confirm("Do you to check out the selected item?")){
		window.location = url;
		return true;
	}else{
		return false;
	}
}
function isSignIn(phpsessid){
	var noOfChk;
	var isFound = false;
	if (phpsessid == ''){
		alert('Please sign in to add items to the cart.');
		return false;
	}else{
		noOfChk = document.getElementById('hidCount').value;
		for(var i = 0; i <= noOfChk; i++){
			if (document.getElementById('chk'+i).checked == true){
				isFound = true;
				break;
			}
		}
	}
	if (isFound == false){
		alert('Please select at least 1 item.');
		return false;
	}else{
		return true;
	}
}

function clearSelectedCheckbox(){
	noOfChk = document.getElementById('hidCount').value;
	for(var i = 0; i <= noOfChk; i++){
		document.getElementById('chk'+i).checked = false;
	}
}

function PrintReport(url){
	window.open(url,'mywindow','width=900,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
}
function sortColumn(url, col_name, order_by){
	document.location = url+'&sort_col='+col_name+'&sort_by='+order_by;
}
function showLogin(){
	window.open('wholesales_login.php','ws_login','location=0,status=0,scrollbars=1,resizable=1,width=240,height=160');
	return false;
}
function hidePrice(){
	window.open('wholesales_logout.php','ws_login','location=0,status=0,scrollbars=1,resizable=1,width=240,height=160');
	return false;
}

var requestAddOneLineItem = createRequest();
function addOneLineItem(itemID, Qty, cartNo, notes){
	var url="add_to_cart_one_line.php?itemID="+itemID+"&Qty="+Qty+"&cartNo="+cartNo+"&notes="+escape(notes);
	url = url + "&dummy=" + new Date().getTime();
	requestAddOneLineItem.open("GET",url,true);
	requestAddOneLineItem.onreadystatechange=addOneLineItem_callback;
	requestAddOneLineItem.send(null);
}
function addOneLineItem_callback(){
	if (requestAddOneLineItem.readyState==4){
		if (requestAddOneLineItem.status==200){
			document.getElementById("divAddCartResult").innerHTML = requestAddOneLineItem.responseText;
			window.location.reload()
			//document.getElementById("ifCartShortcut").src = "cart_shortcut.php"
		}
	}
}

// Wish List
var requestAddWishList = createRequest();
function addWishList(itemID, Qty){
	var url="add_to_wish_list.php?itemID="+itemID+"&Qty="+Qty;
	url = url + "&dummy=" + new Date().getTime();
	requestAddWishList.open("GET",url,true);
	requestAddWishList.onreadystatechange=addWishList_callback;
	requestAddWishList.send(null);
}
function addWishList_callback(){
	if (requestAddWishList.readyState==4){
		if (requestAddWishList.status==200){
			document.getElementById("divAddCartResult").innerHTML = requestAddWishList.responseText;
			window.location.reload()
		}
	}
}

// Wish list...
var requestUpdateWishlistQty = createRequest();
function updateWishlistQty(itemID, Qty){
	var url="upd_wishlist_qty.php?type=wishlist-qty&itemID="+itemID+"&Qty="+Qty;
	url = url + "&dummy=" + new Date().getTime();
	requestUpdateWishlistQty.open("GET",url,true);
	requestUpdateWishlistQty.onreadystatechange=updateWishlistQty_callback;
	requestUpdateWishlistQty.send(null);
}
function updateWishlistQty_callback(){
	if (requestUpdateWishlistQty.readyState==4){
		if (requestUpdateWishlistQty.status==200){
			document.getElementById("divUpdateCartQtyResult").innerHTML = requestUpdateWishlistQty.responseText;
			window.location.reload()
		}
	}
}

// Quotation...
var requestUpdateQuotationQty = createRequest();
function updateQuotationQty(quoNo, itemID, Qty, rowid){
	var url="upd_quo_qty.php?type=quotation-qty&quoNo="+quoNo+"&itemID="+itemID+"&Qty="+Qty+"&quotationorderdetail_id="+rowid;
	url = url + "&dummy=" + new Date().getTime();
	requestUpdateQuotationQty.open("GET",url,true);
	requestUpdateQuotationQty.onreadystatechange=updateQuotationQty_callback;
	requestUpdateQuotationQty.send(null);
}
function updateQuotationQty_callback(){
	if (requestUpdateQuotationQty.readyState==4){
		if (requestUpdateQuotationQty.status==200){
			document.getElementById("divUpdateQuoQtyResult").innerHTML = requestUpdateQuotationQty.responseText;
			window.location.reload()
		}
	}
}

// thumbnail...
var requestThumbnail = createRequest();
var imgSearchID;
function saveAsThumbnail(rowid, itemID, w, h){
	var url="saveAsThumbnail.php?j="+rowid+"&i=" + itemID + ".jpg&w=240&h=180";
	url = url + "&dummy=" + new Date().getTime();
	imgSearchID = rowid;
	requestThumbnail.open("GET",url,true);
	requestThumbnail.onreadystatechange=saveAsThumbnail_callback;
	requestThumbnail.send(null);
}
function saveAsThumbnail_callback(){
	if (requestThumbnail.readyState==4){
		if (requestThumbnail.status==200){
			null;
		}
	}
}

var requestDisplayUpdatingQuotationItem = createRequest();
function displayUpdatingQuotationItem(quoNo, itemID, rowid){
	var url="divUpdateItem.php?quoNo="+quoNo+"&itemID="+itemID+"&quotationorderdetail_id="+rowid;
	url = url + "&dummy=" + new Date().getTime();
	requestDisplayUpdatingQuotationItem.open("GET",url,true);
	requestDisplayUpdatingQuotationItem.onreadystatechange=displayUpdatingQuotationItem_callback;
	requestDisplayUpdatingQuotationItem.send(null);
}
function displayUpdatingQuotationItem_callback(){
	if (requestDisplayUpdatingQuotationItem.readyState==4){
		if (requestDisplayUpdatingQuotationItem.status==200){
			document.getElementById("divDisplayUpdatingQuotationItem").innerHTML = requestDisplayUpdatingQuotationItem.responseText;			
		}
	}
}

// Used on divUpdateItem.php
function calculateTotalPrice(){
	var totalPrice;
	totalPrice = (document.getElementById('txtAmount').value * document.getElementById('cmbItemPrice').value) - document.getElementById('txtDiscountAmount').value;
	document.getElementById('txtTotal').value = totalPrice;
}

var requestUpdateQuotationItem = createRequest();
function updateQuotationItem(quoNo, itemID, Qty, unitPrice, percent, discount, notes, rowid){
	var url="upd_quo_qty.php?type=quotation-item&quoNo="+quoNo+"&itemID="+itemID+"&Qty="+Qty+"&unitPrice="+unitPrice+"&percent="+percent+"&discount="+discount+"&notes="+escape(notes)+"&quotationorderdetail_id="+rowid;
	url = url + "&dummy=" + new Date().getTime();
	requestUpdateQuotationItem.open("GET",url,true);
	requestUpdateQuotationItem.onreadystatechange=updateQuotationItem_callback;
	requestUpdateQuotationItem.send(null);
}
function updateQuotationItem_callback(){
	if (requestUpdateQuotationItem.readyState==4){
		if (requestUpdateQuotationItem.status==200){
			document.getElementById("divUpdateQuoItemResult").innerHTML = requestUpdateQuotationItem.responseText;
			window.location.reload()
		}
	}
}
// End of Quotation's functions

// Cart...
var requestUpdateCartQty = createRequest();
function updateCartQty(itemID, Qty, cart_no, rowid){
	var url="upd_cart_qty.php?type=cart-qty&itemID="+itemID+"&Qty="+Qty+"&cart_no="+cart_no+"&mycart_id="+rowid;
	url = url + "&dummy=" + new Date().getTime();
	requestUpdateCartQty.open("GET",url,true);
	requestUpdateCartQty.onreadystatechange=updateCartQty_callback;
	requestUpdateCartQty.send(null);
}
function updateCartQty_callback(){
	if (requestUpdateCartQty.readyState==4){
		if (requestUpdateCartQty.status==200){
			document.getElementById("divUpdateCartQtyResult").innerHTML = requestUpdateCartQty.responseText;
			window.location.reload()
		}
	}
}

var requestDisplayUpdatingCartItem = createRequest();
function displayUpdatingCartItem(itemID, cartNo, rowid){
	var url="divUpdateCartItem.php?itemID="+itemID+"&cart_no="+cartNo+"&mycart_id="+rowid;
	url = url + "&dummy=" + new Date().getTime();
	requestDisplayUpdatingCartItem.open("GET",url,true);
	requestDisplayUpdatingCartItem.onreadystatechange=displayUpdatingCartItem_callback;
	requestDisplayUpdatingCartItem.send(null);
}
function displayUpdatingCartItem_callback(){
	if (requestDisplayUpdatingCartItem.readyState==4){
		if (requestDisplayUpdatingCartItem.status==200){
			document.getElementById("divDisplayUpdatingCartItem").innerHTML = requestDisplayUpdatingCartItem.responseText;
			calculateCartTotalPrice();
		}
	}
}

// Wish list
var requestDisplayUpdatingWishlistItem = createRequest();
function displayUpdatingWishlistItem(itemID){
	var url="divUpdateWishlistItem.php?itemID="+itemID;
	url = url + "&dummy=" + new Date().getTime();
	requestDisplayUpdatingWishlistItem.open("GET",url,true);
	requestDisplayUpdatingWishlistItem.onreadystatechange=displayUpdatingWishlistItem_callback;
	requestDisplayUpdatingWishlistItem.send(null);
}
function displayUpdatingWishlistItem_callback(){
	if (requestDisplayUpdatingWishlistItem.readyState==4){
		if (requestDisplayUpdatingWishlistItem.status==200){
			document.getElementById("divDisplayUpdatingCartItem").innerHTML = requestDisplayUpdatingWishlistItem.responseText;
			calculateCartTotalPrice();
		}
	}
}

// Used on divUpdateCartItem.php
function calculateCartTotalPrice(){
	var totalPrice;
	totalPrice = (document.getElementById('txtAmount').value * document.getElementById('cmbItemPrice').value) - document.getElementById('txtDiscountAmount').value;
	document.getElementById('txtTotal').value = totalPrice;
}

var requestUpdateCartItem = createRequest();
function updateCartItem(itemID, Qty, unitPrice, percent, discount, cartNo, notes, rowid){
	var url="upd_cart_qty.php?type=cart-item&itemID="+itemID+"&Qty="+Qty+"&unitPrice="+unitPrice+"&percent="+percent+"&discount="+discount+"&cart_no="+cartNo+"&notes="+escape(notes)+"&mycart_id="+rowid;
	url = url + "&dummy=" + new Date().getTime();
	requestUpdateCartItem.open("GET",url,true);
	requestUpdateCartItem.onreadystatechange=updateCartItem_callback;
	requestUpdateCartItem.send(null);
}
function updateCartItem_callback(){
	if (requestUpdateCartItem.readyState==4){
		if (requestUpdateCartItem.status==200){
			document.getElementById("divUpdateCartItemResult").innerHTML = requestUpdateCartItem.responseText;
			window.location.reload()
		}
	}
}
// End of cart...

// Wish list
var requestUpdateWishlistItem = createRequest();
function updateWishlistItem(itemID, Qty, unitPrice, percent, discount){
	var url="upd_wishlist_qty.php?type=wishlist-item&itemID="+itemID+"&Qty="+Qty+"&unitPrice="+unitPrice+"&percent="+percent+"&discount="+discount;
	url = url + "&dummy=" + new Date().getTime();
	requestUpdateWishlistItem.open("GET",url,true);
	requestUpdateWishlistItem.onreadystatechange=updateWishlistItem_callback;
	requestUpdateWishlistItem.send(null);
}
function updateWishlistItem_callback(){
	if (requestUpdateWishlistItem.readyState==4){
		if (requestUpdateWishlistItem.status==200){
			document.getElementById("divUpdateCartItemResult").innerHTML = requestUpdateWishlistItem.responseText;
			window.location.reload()
		}
	}
}

// Favorite Result
var requestFavoriteResult = createRequest();
function addFavoriteResult(itemID){
	var url="add_favorite_item.php?itemID="+itemID+"&action=add";
	url = url + "&dummy=" + new Date().getTime();
	requestFavoriteResult.open("GET",url,true);
	requestFavoriteResult.onreadystatechange=favoriteResult_callback;
	requestFavoriteResult.send(null);
}
function favoriteResult_callback(){
	if (requestFavoriteResult.readyState==4){
		if (requestFavoriteResult.status==200){
			document.getElementById("divFavoriteResultItem").innerHTML = requestFavoriteResult.responseText;
		}
	}
}

var requestRemoveFavoriteItem = createRequest();
function removeFavoriteItem(itemID){
	var url="add_favorite_item.php?itemID="+itemID+"&action=delete";
	url = url + "&dummy=" + new Date().getTime();
	requestRemoveFavoriteItem.open("GET",url,true);
	requestRemoveFavoriteItem.onreadystatechange=removeFavorite_callback;
	requestRemoveFavoriteItem.send(null);
}
function removeFavorite_callback(){
	if (requestRemoveFavoriteItem.readyState==4){
		if (requestRemoveFavoriteItem.status==200){
			document.getElementById("divFavoriteResultItem").innerHTML = requestFavoriteResult.responseText;
			window.location.reload();
		}
	}
}

// This script is used for productgroup_popupmenu.php

function onMouseOverCell(ParentID, GroupID) {
	clearBackgroundColor(ParentID);
	clearPrductGroupPopupMenu(GroupID); 
	loadPrductGroupPopupMenu(GroupID);
	document.getElementById('tr'+GroupID).style.backgroundColor = '#CCCCCC';
	if (document.getElementById('tr'+ParentID)) {
		document.getElementById('tr'+ParentID).style.backgroundColor = '#CCCCCC';
	}
}
function onMouseOutCell(GroupID) {
	document.getElementById('tr'+GroupID).style.backgroundColor = '#FFFFFF';
}

//--------------------------------------TOP MENU----------------------------------------------------------
function hideTopMenu(){
	window.captureEvents(event.click);
	window.onclick = page_click;
}
function page_click() {
	alert('page click event detected!');
}

/*
function hideTopMenu(parentID){
	//alert(parentID);
	clearAllPrductGroupTopMenu(parentID);	
}
*/
function onMouseOverCellTopFirstCol(GroupName) {
	loadPrductGroupTopMenuFirstCol(GroupName);
}
var requestProductGroupTopMenuFirstCol;
var strGroupId;
function loadPrductGroupTopMenuFirstCol(GroupId){
	requestProductGroupTopMenuFirstCol = createRequest();
	var url="productgroup_topmenu_first_col.php?GroupId="+GroupId;
	url = url + "&dummy=" + new Date().getTime();
	strGroupId = GroupId;
	requestProductGroupTopMenuFirstCol.open("GET",url,true);
	requestProductGroupTopMenuFirstCol.onreadystatechange=loadPrductGroupTopMenuFirstCol_callback;
	requestProductGroupTopMenuFirstCol.send(null);
}
function loadPrductGroupTopMenuFirstCol_callback(){
	if (requestProductGroupTopMenuFirstCol.readyState==4){
		if (requestProductGroupTopMenuFirstCol.status==200){
			if (document.getElementById("divProductGroupTopMenu"+strGroupId)){
				document.getElementById("divProductGroupTopMenu"+strGroupId).innerHTML = requestProductGroupTopMenuFirstCol.responseText;
			}
		}
	}
}

function onMouseOverCellTop(ParentID, GroupID) {
	clearBackgroundColorTop(ParentID);
	clearPrductGroupTopMenu(GroupID); 
	loadPrductGroupTopMenu(GroupID);
	if (document.getElementById('trTop'+GroupID))
		document.getElementById('trTop'+GroupID).style.backgroundColor = '#CCCCCC';
	if (document.getElementById('trTop'+ParentID)) {
		document.getElementById('trTop'+ParentID).style.backgroundColor = '#CCCCCC';
	}
}
function onMouseOutCellTop(GroupID) {
	if (document.getElementById('trTop'+GroupID))
		document.getElementById('trTop'+GroupID).style.backgroundColor = '#FFFFFF';
}
var requestProductGroupTopMenu;
var groupIDTop;
function loadPrductGroupTopMenu(_groupID){
	requestProductGroupTopMenu = createRequest();
	var url="productgroup_topmenu.php?ParentID="+_groupID;
	url = url + "&dummy=" + new Date().getTime();
	groupID = _groupID;
	requestProductGroupTopMenu.open("GET",url,true);
	requestProductGroupTopMenu.onreadystatechange=loadPrductGroupTopMenu_callback;
	requestProductGroupTopMenu.send(null);
}
function loadPrductGroupTopMenu_callback(){
	if (requestProductGroupTopMenu.readyState==4){
		if (requestProductGroupTopMenu.status==200){
			if (document.getElementById("divProductGroupTopMenu"+groupID)){
				document.getElementById("divProductGroupTopMenu"+groupID).innerHTML = requestProductGroupTopMenu.responseText;
			}
		}
	}
}

var requestClearProductGroupTopMenu;
function clearPrductGroupTopMenu(_groupID){
	requestClearProductGroupTopMenu = createRequest();
	var url="get_productgroup_popupmenu.php?ParentID="+_groupID;
	url = url + "&dummy=" + new Date().getTime();
	groupID = _groupID;
	requestClearProductGroupTopMenu.open("GET", url, true);
	requestClearProductGroupTopMenu.onreadystatechange=clearPrductGroupTopMenu_callback;
	requestClearProductGroupTopMenu.send(null);
}
function clearPrductGroupTopMenu_callback(){
	if (requestClearProductGroupTopMenu.readyState==4){
		if (requestClearProductGroupTopMenu.status==200){
			var str = requestClearProductGroupTopMenu.responseText;
			var arrList = str.split('-');
			for(var i=0; i<arrList.length; i++){
				if (arrList[i] != groupID){
					document.getElementById("divProductGroupTopMenu"+arrList[i]).innerHTML = "";
				}
			}		
		}
	}
}
function clearBackgroundColorTop(_groupID){
	requestClearBackgroundColor = createRequest();
	var url="clear_background_color.php?ParentID="+_groupID;
	url = url + "&dummy=" + new Date().getTime();
	//alert(url);
	requestClearBackgroundColor.open("GET", url, false);
	requestClearBackgroundColor.onreadystatechange=clearBackgroundColorTop_callback;
	requestClearBackgroundColor.send(null);
}
function clearBackgroundColorTop_callback(){
	if (requestClearBackgroundColor.readyState==4){
		if (requestClearBackgroundColor.status==200){
			var str = requestClearBackgroundColor.responseText;
			var arrList = str.split('-');
			for(var i=0; i<arrList.length; i++){
				document.getElementById("trTop"+arrList[i]).style.backgroundColor = "#FFFFFF";
			}		
		}
	}
}

function scrollBottom(element)
{
	if (document.getElementById(element))
	{
		var objDiv = document.getElementById(element);
		objDiv.scrollTop = objDiv.scrollHeight;
	}
}

function clearAllPrductGroupTopMenu(_groupID){
	if (document.getElementById("divProductGroupTopMenu"+_groupID))
	document.getElementById("divProductGroupTopMenu"+_groupID).innerHTML = "";
}
function clearAllPrductGroupTopMenuFirstCol(groupName){
	if (document.getElementById("divProductGroupTopMenu"+groupName))
	document.getElementById("divProductGroupTopMenu"+groupName).innerHTML = "";
}
//--------------------------------------END TOP MENU----------------------------------------------------------
var requestProductGroupPopupMenu;
var groupID;
function loadPrductGroupPopupMenu(_groupID){
	requestProductGroupPopupMenu = createRequest();
	var url="productgroup_popupmenu.php?ParentID="+_groupID;
	url = url + "&dummy=" + new Date().getTime();
	groupID = _groupID;
	requestProductGroupPopupMenu.open("GET",url,true);
	requestProductGroupPopupMenu.onreadystatechange=loadPrductGroupPopupMenu_callback;
	requestProductGroupPopupMenu.send(null);
}
function loadPrductGroupPopupMenu_callback(){
	if (requestProductGroupPopupMenu.readyState==4){
		if (requestProductGroupPopupMenu.status==200){
			if (document.getElementById("divProductGroupPopupMenu"+groupID)){
				document.getElementById("divProductGroupPopupMenu"+groupID).innerHTML = requestProductGroupPopupMenu.responseText;
			}
		}
	}
}

var requestClearProductGroupPopupMenu;
function clearPrductGroupPopupMenu(_groupID){
	requestClearProductGroupPopupMenu = createRequest();
	var url="get_productgroup_popupmenu.php?ParentID="+_groupID;
	url = url + "&dummy=" + new Date().getTime();
	groupID = _groupID;
	requestClearProductGroupPopupMenu.open("GET", url, true);
	requestClearProductGroupPopupMenu.onreadystatechange=clearPrductGroupPopupMenu_callback;
	requestClearProductGroupPopupMenu.send(null);
}
function clearPrductGroupPopupMenu_callback(){
	if (requestClearProductGroupPopupMenu.readyState==4){
		if (requestClearProductGroupPopupMenu.status==200){
			var str = requestClearProductGroupPopupMenu.responseText;
			var arrList = str.split('-');
			for(var i=0; i<arrList.length; i++){
				if (arrList[i] != groupID){
					document.getElementById("divProductGroupPopupMenu"+arrList[i]).innerHTML = "";
				}
			}		
		}
	}
}

function clearBackgroundColor(_groupID){
	requestClearBackgroundColor = createRequest();
	var url="clear_background_color.php?ParentID="+_groupID;
	url = url + "&dummy=" + new Date().getTime();
	//alert(url);
	requestClearBackgroundColor.open("GET", url, false);
	requestClearBackgroundColor.onreadystatechange=clearBackgroundColor_callback;
	requestClearBackgroundColor.send(null);
}
function clearBackgroundColor_callback(){
	if (requestClearBackgroundColor.readyState==4){
		if (requestClearBackgroundColor.status==200){
			var str = requestClearBackgroundColor.responseText;
			var arrList = str.split('-');
			for(var i=0; i<arrList.length; i++){
				document.getElementById("tr"+arrList[i]).style.backgroundColor = "#FFFFFF";
			}		
		}
	}
}

function clearAllPrductGroupPopupMenu(_groupID){
	if (document.getElementById("divProductGroupPopupMenu"+_groupID))
		document.getElementById("divProductGroupPopupMenu"+_groupID).innerHTML = "";
}

function searchSelectCategory(categoryID, categoryDes, detailGroupID){	
	// Group Id
	if (document.getElementById('hidSelectedCategory'))
		document.getElementById('hidSelectedCategory').value = categoryID;
	if (document.getElementById('divSelectedCategory'))
		document.getElementById('divSelectedCategory').innerHTML = categoryDes;
	
	// Detail Group Id
	if (document.getElementById('hidDetailGroupID'))
		document.getElementById('hidDetailGroupID').value = detailGroupID;
	document.getElementById('frmSearch').submit();
}
//-->
// ------------------- search_shortcut.php --------------------
var requestIBNC = createRequest();
function loadItemBrandNameChild(parentId){	
	var url = "../load_item_brand_name_child.php?parent_id="+parentId;
	url = url + "&dummy=" + new Date().getTime();
	requestIBNC.open("GET",url,true);
	requestIBNC.onreadystatechange = loadItemBrandNameChild_Callback;
	requestIBNC.send(null);
}
function loadItemBrandNameChild_Callback(){
	if (requestIBNC.readyState==4){
		if (requestIBNC.status==200){
			var item_brand_name_child = requestIBNC.responseText;
			if (requestIBNC.responseText != ""){
				nrec = item_brand_name_child.split("##");
				num_rec=nrec.length;
				document.getElementById('cmbItemBrandNameChild').length=num_rec;
				document.getElementById('cmbItemBrandNameChild').options[0] = new Option("SELECT ONE...");
				document.getElementById('cmbItemBrandNameChild').options[0].value = 0;
				for (i=0;i<num_rec;i++){
					ctype=nrec[i].split("#");
					document.getElementById('cmbItemBrandNameChild').options[i+1] = new Option(ctype[1]);
					document.getElementById('cmbItemBrandNameChild').options[i+1].value=ctype[0];
				}
			}else{
				document.getElementById('cmbItemBrandNameChild').options[0] = new Option("NO DETAIL...");
				document.getElementById('cmbItemBrandNameChild').options[0].value = 0;
			}
		}
	}	
}
// -----------------------------------------------------

// ------------------- image_by_car.php --------------------
var requestRandomImageByCar = createRequest();
function randomImageByCar(){	
	window.setInterval( "loadImageByCar();", 5000); // 5000 milliseconds delay
}
function loadImageByCar(){	
	var url = "image_by_car.php";
	url = url + "?dummy=" + new Date().getTime();
	requestRandomImageByCar.open("GET",url,true);
	requestRandomImageByCar.onreadystatechange = loadImageByCar_Callback;
	requestRandomImageByCar.send(null);
}
function loadImageByCar_Callback(){
	if (requestRandomImageByCar.readyState==4){
		if (requestRandomImageByCar.status==200){
			document.getElementById("divImageByCar").innerHTML = requestRandomImageByCar.responseText;
		}
	}	
}
// -----------------------------------------------------
var requestRefreshDropdownAdvanceSearch = createRequest();
var eleDropdown;
function refreshDropdownAdvanceSearch(dropdownType, dropdownID, elementID){	
	eleDropdown = document.getElementById(elementID);
	var url = "refreshDropdownAdvanceSearch.php?dropdownType="+dropdownType+"&elementID="+elementID;
	url = url + "&dummy=" + new Date().getTime();
	requestRefreshDropdownAdvanceSearch.open("GET",url,true);
	requestRefreshDropdownAdvanceSearch.onreadystatechange = refreshDropdownAdvanceSearch_Callback;
	requestRefreshDropdownAdvanceSearch.send(null);
}
function refreshDropdownAdvanceSearch_Callback(){
	if (requestRefreshDropdownAdvanceSearch.readyState==4){
		if (requestRefreshDropdownAdvanceSearch.status==200){
			//divDropdown.innerHTML = requestRefreshDropdownAdvanceSearch.responseText;
			var dropdownString = requestRefreshDropdownAdvanceSearch.responseText;
			nrec = dropdownString.split("##");
			num_rec=nrec.length;
			eleDropdown.length=num_rec;
			for (i=0;i<num_rec;i++){
				ctype=nrec[i].split("#");
				eleDropdown.options[i] = new Option(ctype[1]);
				eleDropdown.options[i].value=ctype[0];
			}
		}
	}else{
		eleDropdown.options[0] = new Option("Loading...");
	}
}
//------------------------------------------------------
// product_caryear_selection.php -----------------
var requestProductCarYear = createRequest();
function saveProductCarYearSelection(itemID, carYearID, eleChecked){
	if (eleChecked == true) var chk = 1; else var chk = 0;
	var url = "save_product_car_year_selection.php?itemID="+itemID+"&carYearID="+carYearID+"&checked="+chk;
	url = url + "&dummy=" + new Date().getTime();
	requestProductCarYear.open("GET",url,true);
	requestProductCarYear.onreadystatechange = requestProductCarYear_Callback;
	requestProductCarYear.send(null);
}
function requestProductCarYear_Callback(){
	if (requestProductCarYear.readyState==4){
		if (requestProductCarYear.status==200){
			document.getElementById('divProductCarYear').innerHTML = requestProductCarYear.responseText;
		}
	}else{
		document.getElementById('divProductCarYear').innerHTML = "Updating your selected data...";
	}
}
var requestAddCarYear = createRequest();
function addCarYear(carPropertyType, carYear){
	if (carYear != ''){
		var url = "add_car_year.php?carPropertyType="+carPropertyType+"&carYear="+carYear;
		url = url + "&dummy=" + new Date().getTime();
		requestAddCarYear.open("GET",url,true);
		requestAddCarYear.onreadystatechange = requestAddCarYear_Callback;
		requestAddCarYear.send(null);
	}
}
function requestAddCarYear_Callback(){
	if (requestAddCarYear.readyState==4){
		if (requestAddCarYear.status==200){
			document.getElementById('divProductCarYear').innerHTML = requestAddCarYear.responseText;
			window.location.reload();			
		}
	}else{
		document.getElementById('divProductCarYear').innerHTML = "Updating your selected data...";
	}
}
//------------------------------------------------------
var requestDeleteCarYear = createRequest();
function deleteCarYear(carPropertyType, carYearID){
	if (carYearID != '' && confirm("Do you want to delete this record?")){
		var url = "delete_car_year.php?carPropertyType="+carPropertyType+"&carYearID="+carYearID;
		url = url + "&dummy=" + new Date().getTime();
		requestDeleteCarYear.open("GET",url,true);
		requestDeleteCarYear.onreadystatechange = requestDeleteCarYear_Callback;
		requestDeleteCarYear.send(null);
	}
}
function requestDeleteCarYear_Callback(){
	if (requestDeleteCarYear.readyState==4){
		if (requestDeleteCarYear.status==200){
			document.getElementById('divProductCarYear').innerHTML = requestDeleteCarYear.responseText;
			window.location.reload();			
		}
	}else{
		document.getElementById('divProductCarYear').innerHTML = "Updating your selected data...";
	}
}
//------------------------------------------------------
var requestUpdateCarYear = createRequest();
function updateCarYear(carPropertyType, carYear, carYearID){
	if (carYear != ''){
		var url = "update_car_year.php?carPropertyType="+carPropertyType+"&carYear="+carYear+"&carYearID="+carYearID;
		url = url + "&dummy=" + new Date().getTime();
		requestUpdateCarYear.open("GET",url,true);
		requestUpdateCarYear.onreadystatechange = updateCarYear_Callback;
		requestUpdateCarYear.send(null);
	}
}
function updateCarYear_Callback(){
	if (requestUpdateCarYear.readyState==4){
		if (requestUpdateCarYear.status==200){
			document.getElementById('divProductCarYear').innerHTML = requestAddCarYear.responseText;
			window.location.reload();			
		}
	}else{
		document.getElementById('divProductCarYear').innerHTML = "Updating your selected data...";
	}
}
//--------------------------------------------------------------------------
// product_location_selection.php -----------------
var requestProductLocation = createRequest();
function saveProductLocationSelection(itemID, locationID, eleChecked){
	if (eleChecked == true) var chk = 1; 
	else var chk = 0;
	var url = "save_product_location_selection.php?itemID="+itemID+"&locationID="+locationID+"&checked="+chk;
	url = url + "&dummy=" + new Date().getTime();
	requestProductLocation.open("GET",url,true);
	requestProductLocation.onreadystatechange = requestProductLocation_Callback;
	requestProductLocation.send(null);
}
function requestProductLocation_Callback(){
	if (requestProductLocation.readyState==4){
		if (requestProductLocation.status==200){
			document.getElementById('divProductLocation').innerHTML = requestProductLocation.responseText;
			window.location.reload();
		}
	}else{
		document.getElementById('divProductLocation').innerHTML = "Updating your selected data...";
	}
}
var requestAddLocation = createRequest();
function addLocation(no, location){
	if (location != ''){
		var url = "add_location.php?location_no="+no+"&location="+location;
		url = url + "&dummy=" + new Date().getTime();
		requestAddLocation.open("GET",url,true);
		requestAddLocation.onreadystatechange = requestAddLocation_Callback;
		requestAddLocation.send(null);
	}
}
function requestAddLocation_Callback(){
	if (requestAddLocation.readyState==4){
		if (requestAddLocation.status==200){
			document.getElementById('divProductLocation').innerHTML = requestAddLocation.responseText;
			window.location.reload();			
		}
	}else{
		document.getElementById('divProductLocation').innerHTML = "Updating your selected data...";
	}
}
//------------------------------------------------------
var requestDeleteLocation = createRequest();
function deleteLocation(locationID){
	if (locationID != '' && confirm("Do you want to delete this record?")){
		var url = "delete_product_location.php?locationID="+locationID;
		url = url + "&dummy=" + new Date().getTime();
		requestDeleteLocation.open("GET",url,true);
		requestDeleteLocation.onreadystatechange = requestDeleteLocation_Callback;
		requestDeleteLocation.send(null);
	}
}
function requestDeleteLocation_Callback(){
	if (requestDeleteLocation.readyState==4){
		if (requestDeleteLocation.status==200){
			document.getElementById('divProductLocation').innerHTML = requestDeleteLocation.responseText;
			window.location.reload();			
		}
	}else{
		document.getElementById('divProductLocation').innerHTML = "Updating your selected data...";
	}
}
//------------------------------------------------------
var requestUpdateLocation = createRequest();
function updateLocation(locationNo, location, locationID){
	if (location != ''){
		var url = "update_location.php?locationNo="+locationNo+"&location="+location+"&locationID="+locationID;
		url = url + "&dummy=" + new Date().getTime();
		requestUpdateLocation.open("GET",url,true);
		requestUpdateLocation.onreadystatechange = updateLocation_Callback;
		requestUpdateLocation.send(null);
	}
}
function updateLocation_Callback(){
	if (requestUpdateLocation.readyState==4){
		if (requestUpdateLocation.status==200){
			document.getElementById('divProductLocation').innerHTML = requestUpdateLocation.responseText;
			window.location.reload();			
		}
	}else{
		document.getElementById('divProductLocation').innerHTML = "Updating your selected data...";
	}
}
//--------------------------------------------------------------------------
var requestEnterChat;
function enterChat(e)
{
	if (e.keyCode == 13) 
	{
		requestEnterChat = createRequest();
		words = encodeURIComponent(document.getElementById('txtChatWords').value);
		receiver = encodeURIComponent(document.getElementById('hidReceiver').value);
		var url = "enterChat.php?words="+words+"&action=add&receiver="+receiver;
		url = url + "&dummy=" + new Date().getTime();
		requestEnterChat.open("GET",url,true);
		requestEnterChat.onreadystatechange = enterChat_Callback;
		requestEnterChat.send(null);
	}
}
function enterChat_Callback(){
	if (requestEnterChat.readyState==4){
		if (requestEnterChat.status==200){
			document.getElementById('divChatMessage').innerHTML = requestEnterChat.responseText;
			document.getElementById('txtChatWords').value = "";
			scrollBottom('divChatMessage');
			loadChatContact();
		}
	}
}
function loadChat(sender)
{
	requestEnterChat = createRequest();
	if (document.getElementById('hidReceiver')) document.getElementById('hidReceiver').value = sender;
	sender = encodeURIComponent(sender);
	var url = "loadChat.php?sender="+sender;
	url = url + "&dummy=" + new Date().getTime();
	requestEnterChat.open("GET",url,true);
	requestEnterChat.onreadystatechange = loadChat_Callback;
	requestEnterChat.send(null);
}
function loadChat_Callback(){
	if (requestEnterChat.readyState==4){
		if (requestEnterChat.status==200){
			document.getElementById('divChatMessage').innerHTML = requestEnterChat.responseText;
			/*
			if (document.getElementById('txtChatWords').value == "") 
				document.getElementById('txtChatWords').value = "[Type a message here]";
			*/
			scrollBottom('divChatMessage');
		}
	}
}
function loadChatContact()
{
	requestLoadChatContact = createRequest();
	var url = "loadChatContact.php";
	url = url + "?dummy=" + new Date().getTime();
	requestLoadChatContact.open("GET",url,true);
	requestLoadChatContact.onreadystatechange = loadChatContact_Callback;
	requestLoadChatContact.send(null);
}
function loadChatContact_Callback(){
	if (requestLoadChatContact.readyState==4){
		if (requestLoadChatContact.status==200){
			if (document.getElementById('divChatContactList') && requestLoadChatContact.responseText != "") {
				var output = requestLoadChatContact.responseText;
				var outputs = output.split("||");
				
				// [0] = Has new msg to shop staff...
				// [1] = Displayed HTML
				
				if (outputs[0] == "YES"){
					// Display chat 
					document.getElementById('chatShortcut').style.display = 'block';
					document.getElementById('chatShortcutTitle').style.display = 'none';
				}
				
				document.getElementById('divChatContactList').style.height = '110px';
				document.getElementById('divChatContactList').innerHTML = outputs[1];				
			}else{
				document.getElementById('divChatContactList').style.height = '0px';
			}
		}
	}
}
function hasNewMsg()
{
	requestHasNewMsg = createRequest();
	var url = "hasNewMsg.php";
	url = url + "?dummy=" + new Date().getTime();
	requestHasNewMsg.open("GET",url,true);
	requestHasNewMsg.onreadystatechange = hasNewMsgToYou_Callback;
	requestHasNewMsg.send(null);
}
function hasNewMsgToYou_Callback(){
	if (requestHasNewMsg.readyState==4){
		if (requestHasNewMsg.status==200){
			var output = requestHasNewMsg.responseText;
			var outputs = output.split("-");
			// [0] - YES = Has New Msg / NO = Has not New Msg
			// [1] - YES = Refresh Chat (IP Outbound) / NO = Not Refresh Chat (IP Inbound)
			// [2] = Receiver's Name
			if (outputs[0] == "YES") {
				document.getElementById('chatShortcut').style.display = 'block';
				document.getElementById('chatShortcutTitle').style.display = 'none';
			}
			if (outputs[1] == "YES") {
				loadChat(outputs[2]);
			}
		}
	}
}
//------------------------------------------------------
var requestLoadQuotationShortcut;
function loadQuotationShortcut(startRowAt){
	requestLoadQuotationShortcut = createRequest();
	var url = "quotation_shortcut.php?startRowAt="+startRowAt;
	url = url + "&dummy=" + new Date().getTime();
	requestLoadQuotationShortcut.open("GET",url,true);
	requestLoadQuotationShortcut.onreadystatechange = loadQuotationShortcut_Callback;
	requestLoadQuotationShortcut.send(null);
}
function loadQuotationShortcut_Callback(){
	if (requestLoadQuotationShortcut.readyState==4){
		if (requestLoadQuotationShortcut.status==200){
			document.getElementById('divQuotationShortcut').innerHTML = requestLoadQuotationShortcut.responseText;
		}
	}
}
//------------------------------------------------------
function Set_Cookie(name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

// this fixes an issue with the old method, ambiguous values
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie(check_name) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function pressCategoryAdvance(){
	if (Get_Cookie('advancePressed') == 1){
		document.getElementById('tblCategoryAdvance').style.display = 'none';
		Delete_Cookie('advancePressed');
	}else{
		Set_Cookie('advancePressed', 1, 1);
		document.getElementById('tblCategoryAdvance').style.display = 'block';
	}
}
function loadCategoryAdvance(){
	if (Get_Cookie('advancePressed') == 1){
		document.getElementById('tblCategoryAdvance').style.display = 'block';
	}else{
		document.getElementById('tblCategoryAdvance').style.display = 'none';
	}
}
