function ddtabcontent(tabinterfaceid){
	this.tabinterfaceid=tabinterfaceid //ID of Tab Menu main container
	this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a") //Get all tab links within container
	this.enabletabpersistence=true
	this.hottabspositions=[] //Array to store position of tabs that have a "rel" attr defined, relative to all tab links, within container
	this.currentTabIndex=0 //Index of currently selected hot tab (tab with sub content) within hottabspositions[] array
	this.subcontentids=[] //Array to store ids of the sub contents ("rel" attr values)
	this.revcontentids=[] //Array to store ids of arbitrary contents to expand/contact as well ("rev" attr values)
	this.selectedClassTarget="link" //keyword to indicate which target element to assign "selected" CSS class ("linkparent" or "link")
}

ddtabcontent.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

ddtabcontent.setCookie=function(name, value){
	document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
}

ddtabcontent.prototype={

	expandit:function(tabid_or_position){ //PUBLIC function to select a tab either by its ID or position(int) within its peers
		this.cancelautorun() //stop auto cycling of tabs (if running)
		var tabref=""
		try{
			if (typeof tabid_or_position=="string" && document.getElementById(tabid_or_position).getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=document.getElementById(tabid_or_position)
			else if (parseInt(tabid_or_position)!=NaN && this.tabs[tabid_or_position].getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=this.tabs[tabid_or_position]
		}
		catch(err){alert("Invalid Tab ID or position entered!")}
		if (tabref!="") //if a valid tab is found based on function parameter
			this.expandtab(tabref) //expand this tab
	},

	cycleit:function(dir, autorun){ //PUBLIC function to move foward or backwards through each hot tab (tabinstance.cycleit('foward/back') )
		if (dir=="next"){
			var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)? this.currentTabIndex+1 : 0
		}
		else if (dir=="prev"){
			var currentTabIndex=(this.currentTabIndex>0)? this.currentTabIndex-1 : this.hottabspositions.length-1
		}
		if (typeof autorun=="undefined") //if cycleit() is being called by user, versus autorun() function
			this.cancelautorun() //stop auto cycling of tabs (if running)
		this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
	},

	setpersist:function(bool){ //PUBLIC function to toggle persistence feature
			this.enabletabpersistence=bool
	},

	setselectedClassTarget:function(objstr){ //PUBLIC function to set which target element to assign "selected" CSS class ("linkparent" or "link")
		this.selectedClassTarget=objstr || "link"
	},

	getselectedClassTarget:function(tabref){ //Returns target element to assign "selected" CSS class to
		return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref
	},

	urlparamselect:function(tabinterfaceid){
		var result=window.location.search.match(new RegExp(tabinterfaceid+"=(\\d+)", "i")) //check for "?tabinterfaceid=2" in URL
		return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
	},

	expandtab:function(tabref){
		var subcontentid=tabref.getAttribute("rel") //Get id of subcontent to expand
		//Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easily search through
		var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
		this.expandsubcontent(subcontentid)
		this.expandrevcontent(associatedrevids)
		for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
			this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)? "selected" : ""
		}
		if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
			ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
		this.setcurrenttabindex(tabref.tabposition) //remember position of selected tab within hottabspositions[] array
	},

	expandsubcontent:function(subcontentid){
		for (var i=0; i<this.subcontentids.length; i++){
			var subcontent=document.getElementById(this.subcontentids[i]) //cache current subcontent obj (in for loop)
			subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none" //"show" or hide sub content based on matching id attr value
		}
	},

	expandrevcontent:function(associatedrevids){
		var allrevids=this.revcontentids
		for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
			//if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
			document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
		}
	},

	setcurrenttabindex:function(tabposition){ //store current position of tab (within hottabspositions[] array)
		for (var i=0; i<this.hottabspositions.length; i++){
			if (tabposition==this.hottabspositions[i]){
				this.currentTabIndex=i
				break
			}
		}
	},

	autorun:function(){ //function to auto cycle through and select tabs based on a set interval
		this.cycleit('next', true)
	},

	cancelautorun:function(){
		if (typeof this.autoruntimer!="undefined")
			clearInterval(this.autoruntimer)
	},

	init:function(automodeperiod){
		var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
		var selectedtab=-1 //Currently selected tab index (-1 meaning none)
		var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
		this.automodeperiod=automodeperiod || 0
		for (var i=0; i<this.tabs.length; i++){
			this.tabs[i].tabposition=i //remember position of tab relative to its peers
			if (this.tabs[i].getAttribute("rel")){
				var tabinstance=this
				this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
				this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
				this.tabs[i].onclick=function(){
					tabinstance.expandtab(this)
					tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
					return false
				}
				if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
					this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
				}
				if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
					selectedtab=i //Selected tab index, if found
				}
			}
		} //END for loop
		if (selectedtab!=-1) //if a valid default selected tab index is found
			this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
		else //if no valid default selected index found
			this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
		if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
			this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
		}
	} //END int() function

} //END Prototype assignment

/* Simple AJAX Code-Kit (SACK) */
/* ©2005 Gregory Wild-Smith */
/* www.twilightuniverse.com */
/* Software licenced under a modified X11 licence, see documentation or authors website for more details */

function sack(file){
	this.AjaxFailedAlert = "Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n";
	this.requestFile = file;
	this.method = "POST";
	this.URLString = "";
	this.encodeURIString = true;
	this.execute = false;

	this.onLoading = function() { };
	this.onLoaded = function() { };
	this.onInteractive = function() { };
	this.onCompletion = function() { };

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (err) {
				this.xmlhttp = null;
			}
		}
		if(!this.xmlhttp && typeof XMLHttpRequest != "undefined")
			this.xmlhttp = new XMLHttpRequest();
		if (!this.xmlhttp){
			this.failed = true; 
		}
	};
	
	this.setVar = function(name, value){
		if (this.URLString.length < 3){
			this.URLString = name + "=" + value;
		} else {
			this.URLString += "&" + name + "=" + value;
		}
	}
	
	this.encVar = function(name, value){
		var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
	return varString;
	}
	
	this.encodeURLString = function(string){
		varArray = string.split('&');
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split('=');
			if (urlVars[0].indexOf('amp;') != -1){
				urlVars[0] = urlVars[0].substring(4);
			}
			varArray[i] = this.encVar(urlVars[0],urlVars[1]);
		}
	return varArray.join('&');
	}
	
	this.runResponse = function(){
		eval(this.response);
	}
	
	this.runAJAX = function(urlstring){
		this.responseStatus = new Array(2);
		if(this.failed && this.AjaxFailedAlert){ 
			alert(this.AjaxFailedAlert); 
		} else {
			if (urlstring){ 
				if (this.URLString.length){
					this.URLString = this.URLString + "&" + urlstring; 
				} else {
					this.URLString = urlstring; 
				}
			}
			if (this.encodeURIString){
				var timeval = new Date().getTime(); 
				this.URLString = this.encodeURLString(this.URLString);
				this.setVar("rndval", timeval);
			}
			if (this.element) { this.elementObj = document.getElementById(this.element); }
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					var totalurlstring = this.requestFile + "?" + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
				}
				if (this.method == "POST"){
  					try {
						this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')  
					} catch (e) {}
				}

				this.xmlhttp.send(this.URLString);
				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState){
						case 1:
							self.onLoading();
						break;
						case 2:
							self.onLoaded();
						break;
						case 3:
							self.onInteractive();
						break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;
							self.onCompletion();
							if(self.execute){ self.runResponse(); }
							if (self.elementObj) {
								var elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea"){
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							self.URLString = "";
						break;
					}
				};
			}
		}
	};
this.createAJAX();
}
function ajaxLoad(url,id)
   {
       if (document.getElementById) {
           var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
           }
           if (x)
               {
           x.onreadystatechange = function()
                   {
                       el = document.getElementById(id);
                       document.getElementById('loading').style.display = 'block';
               if (x.readyState == 4 && x.status == 200)
                       {
                       el.innerHTML = x.responseText;
                       document.getElementById('loading').style.display = 'none';
                   }
                   }
               x.open("GET", url, true);
               x.send(null);
               }
       }
/*--------------------------
Ajax post
-----------------------------*/   
   var http_request = false;
   
   function show_hint ( p_hint_text, p_span ) {
		document.getElementById(p_span).style.display = 'block';
    document.getElementById(p_span).innerHTML = p_hint_text ;
	}
   
   function makePOSTRequest(url, parameters, SpanName) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }

      http_request.onreadystatechange = function() {
		  if (http_request.readyState == 4) {
			 if (http_request.status == 200) {
				//alert(http_request.responseText);
				result = http_request.responseText;
				document.getElementById(SpanName).innerHTML = result;
    		document.getElementById('loading').style.display = 'none';
    		document.getElementById('loading').innerHTML = "Đang tải ...";          
			 } else {
				alert('There was a problem with the request.');
			 }
		  }
      };
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

function checkuser()
{
els=document.getElementById('x_receive');
 if (document.getElementById) 
	{
           var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
           }
           if (x)
               {
           x.onreadystatechange = function()
                   {
                       el = document.getElementById('recv_status');
                       $('recv_status').innerHTML = 'checking...';
               if (x.readyState == 4 && x.status == 200)
                       	{
                      	 el.innerHTML = x.responseText;
                   	}
                   }
               x.open("GET",'funcs/u_search.php?uname='+els.value, true);
               x.send(null);
         }
}
/*--------------------------
Chuyển trạng thái hiển thị
-----------------------------*/   
<!--
/* toggle items */
function toggleItem(item) {
  if ((document.getElementById(item).style.display=='none') ||
      (document.getElementById(item).style.display=='')) {
    document.getElementById(item).style.display='block';
  } else {
    document.getElementById(item).style.display='none';
  }
};
function ShowHide(obj, visibility) {
	if(document.getElementById){
		divs = document.getElementsByTagName("div");
    		divs[obj].style.visibility = visibility;
	}
}
//-->
/*--------------------------
không cho nhấn phím Enter
-----------------------------*/
function handleEnter(field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}
//-----------------------
function confirmDelete()
{
var agree=confirm("Bạn có chắc là muốn xoá?");
if (agree)
	return true ;
else
	return false ;
}
function confirmDeleteCat(obj)
{
var agree=confirm("Xoá chuyên mục [ "+obj+" ] và tất cả các\nsản phẩm trong đó? Cẩn thận! Không thể phục hồi.");
if (agree)
	return true ;
else
	return false ;
}
function CreateElementEnd(ToDiv,DivName) { 
	if(document.createElement){ 
		var el = document.createElement("DIV"); 
		el.id = DivName+Math.round(Math.random()*1000);
		with(el.style){ 
			color = "#333"; 
			backgroundColor = "#ecf1f3"; 
		} 
		el.innerHTML = el.id;
		document.getElementById(ToDiv).appendChild(el); 
	} 
} 
//-----------Form Proccess---------
function CheckFormSearch() {
	var errorMsg = "";
	if (document.product_search.x_search.value==''){
		errorMsg += "\n - Nhập từ khóa";
	}
	if (errorMsg != ""){
		msg = "_______________________________________________________________\n\n";
		msg += "Yêu cầu của bạn không thể thực hiện vì còn có 1 số lỗi.\n";
		msg += "Vui lòng kiểm tra và gửi lại lần nữa.\n";
		msg += "_______________________________________________________________\n\n";
		msg += "Các trường dưới đây cần được kiểm tra: \n";

		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function CheckFormAdvs() {
	var errorMsg = "";
	if (document.form_advs.site_link.value==''){
		errorMsg += "\n - Liên kết";
	}
	if (document.form_advs.logo_url.value==''){
		errorMsg += "\n - Logo";
	}
	if (errorMsg != ""){
		msg = "_______________________________________________________________\n\n";
		msg += "Yêu cầu của bạn không thể thực hiện vì còn có 1 số lỗi.\n";
		msg += "Vui lòng kiểm tra và gửi lại lần nữa.\n";
		msg += "_______________________________________________________________\n\n";
		msg += "Các trường dưới đây cần được kiểm tra: \n";

		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function CheckPass() {
	var errorMsg = "";
	if (document.frm_password.x_password.value==''){
		errorMsg += "\n - Mật khẩu";
	}
	if (document.frm_password.x_password2.value==''){
		errorMsg += "\n - Xác nhận mật khẩu";
	}
	if (document.frm_password.x_password2.value!=document.frm_password.x_password.value){
		errorMsg += "\n - Mật khẩu xác nhận không khớp";
	}
	if (errorMsg != ""){
		msg = "_______________________________________________________________\n\n";
		msg += "Yêu cầu của bạn không thể thực hiện vì còn có 1 số lỗi.\n";
		msg += "Vui lòng kiểm tra và gửi lại lần nữa.\n";
		msg += "_______________________________________________________________\n\n";
		msg += "Các trường dưới đây cần được kiểm tra: \n";

		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function CheckFormCat(frms) {
	var errorMsg = "";
	var frmx=frms;
	if (document.getElementById(frmx).x_parent_id.value==''){
		errorMsg += "\n - Chọn chuyên mục cấp trên";
	}
	if (document.getElementById(frmx).x_name.value==''){
		errorMsg += "\n - Nhập tên của chuyên mục";
	}
	if (errorMsg != ""){
		msg = "_______________________________________________________________\n\n";
		msg += "Yêu cầu của bạn không thể thực hiện vì còn có 1 số lỗi.\n";
		msg += "Vui lòng kiểm tra và gửi lại lần nữa.\n";
		msg += "_______________________________________________________________\n\n";
		msg += "Các trường dưới đây cần được kiểm tra: \n";

		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function product_search(obj,SpanName) {
   	var poststr = "x_search=" + encodeURI( document.getElementById("x_search").value );
      var SpanName = SpanName;             
	  	makePOSTRequest('mods/search.php', poststr, SpanName);
   }
function product_search2(obj,SpanName) {
   	var poststr = "x_search=" + encodeURI( document.getElementById("x_search").value );
      var SpanName = SpanName;             
	  	makePOSTRequest('frms/ls_products.php', poststr, SpanName);
   }
function CheckFormProduct() {
	var errorMsg = "";
	if (document.frm_product_add.x_cat_id.value==''){
		errorMsg += "\n - Chuyên mục";
	}
	if (document.frm_product_add.x_product.value==''){
		errorMsg += "\n - Tên sản phẩm";
	}
	if (document.frm_product_add.x_detail.value==''){
		errorMsg += "\n - Chi tiết sản phẩm";
	}
	if (document.frm_product_add.x_price.value==''){
		errorMsg += "\n - Giá cả";
	}
	if (document.frm_product_add.x_quaranty.value==''){
		errorMsg += "\n - Thời gian bảo hành";
	}
	if (errorMsg != ""){
		msg = "_______________________________________________________________\n\n";
		msg += "Yêu cầu của bạn không thể thực hiện vì còn có 1 số lỗi.\n";
		msg += "Vui lòng kiểm tra và gửi lại lần nữa.\n";
		msg += "_______________________________________________________________\n\n";
		msg += "Các trường dưới đây cần được kiểm tra: \n";

		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function CheckFormMail() {
	var errorMsg = "";
	if (document.contactform.uname.value==''){
		errorMsg += "\n - Tên của bạn";
	}
	if (document.contactform.email.value==''){
		errorMsg += "\n - Email của bạn";
	}
	if (document.contactform.comment.value.length<20){
		errorMsg += "\n - Nội dung quá ngắn";
	}
	if (errorMsg != ""){
		msg = "_______________________________________________________________\n\n";
		msg += "Yêu cầu của bạn không thể thực hiện vì còn có 1 số lỗi.\n";
		msg += "Vui lòng kiểm tra và gửi lại lần nữa.\n";
		msg += "_______________________________________________________________\n\n";
		msg += "Các trường dưới đây cần được kiểm tra: \n";

		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
function send_mail(obj,SpanName) {
   	var poststr = "uname=" + encodeURI( document.getElementById("uname").value ) +
   			"&email=" + encodeURI( document.getElementById("email").value ) +
   			"&comment=" + encodeURI( document.getElementById("comment").value ) ;
      var SpanName = SpanName;             
	  makePOSTRequest('frms/mail_proc.php', poststr, SpanName);
   }
function cat_add(obj,SpanName) {
var SpanName = SpanName;         
   if(document.createElement){ 
		var el = document.createElement("DIV"); 
		el.id = "cat_"+Math.round(Math.random()*1000);     
		with(el.style){ 
			color = "#333"; 
			backgroundColor = "#ecf1f3"; 
		}
		newspan=el.id;
		document.getElementById(SpanName).appendChild(el); 
		}
	  var poststr = "x_span=" + newspan +
   	"&x_parent_id=" + encodeURI( document.getElementById("x_parent_id").value ) +
   	"&x_name=" + encodeURI( document.getElementById("x_name").value ) ;
		makePOSTRequest('frms/one_cat.php?do=add', poststr, newspan);
   }
function cat_edit(obj,SpanName) {
   	var poststr = "x_id=" + encodeURI( document.getElementById("x_id").value ) +
   			"&x_parent_id=" + encodeURI( document.getElementById("x_parent_id").value ) +
   			"&x_name=" + encodeURI( document.getElementById("x_name").value ) ;
      var SpanName = SpanName;             
	  makePOSTRequest('frms/one_cat.php?do=post', poststr, SpanName);
   }
function product_add(obj,SpanName) {
   	var poststr = "x_cat_id=" + encodeURI( document.getElementById("x_cat_id").value ) +
   			"&x_product=" + encodeURI( document.getElementById("x_product").value ) +
   			"&x_detail=" + encodeURI( document.getElementById("x_detail").value ) +
   			"&x_price=" + encodeURI( document.getElementById("x_price").value ) +
   			"&x_quaranty=" + encodeURI( document.getElementById("x_quaranty").value ) +
   			"&x_bonus=" + encodeURI( document.getElementById("x_bonus").value ) +
   			"&x_img_thumb=" + encodeURI( document.getElementById("x_img_thumb").value ) +
   			"&x_img_big=" + encodeURI( document.getElementById("x_img_big").value ) ;
      var SpanName = SpanName;             
	  makePOSTRequest('frms/ls_products.php?do=post', poststr, SpanName);
   }
function product_edit(obj,SpanName) {
   	var poststr = "x_cat_id=" + encodeURI( document.getElementById("x_cat_id").value ) +
   			"&x_pid=" + encodeURI( document.getElementById("x_pid").value ) +
   			"&x_product=" + encodeURI( document.getElementById("x_product").value ) +
   			"&x_detail=" + encodeURI( document.getElementById("x_detail").value ) +
   			"&x_price=" + encodeURI( document.getElementById("x_price").value ) +
   			"&x_new_price=" + encodeURI( document.getElementById("x_new_price").value ) +
   			"&x_quaranty=" + encodeURI( document.getElementById("x_quaranty").value ) +
   			"&x_bonus=" + encodeURI( document.getElementById("x_bonus").value ) +
   			"&x_status=" + encodeURI( document.getElementById("x_status").value ) +
   			"&x_img_thumb=" + encodeURI( document.getElementById("x_img_thumb").value ) +
   			"&x_img_big=" + encodeURI( document.getElementById("x_img_big").value ) ;
      var SpanName = SpanName;             
	  makePOSTRequest('frms/ls_products.php?do=edit', poststr, SpanName);
   }
function info_edit(obj,SpanName) {
   	var poststr = "x_id=" + encodeURI( document.getElementById("x_id").value ) +
   			"&x_info=" + encodeURI( document.getElementById("x_info").value ) ;
      var SpanName = SpanName;             
	  makePOSTRequest('frms/conf.php', poststr, SpanName);
   }
function fixPlace(xid,obj,SpanName) {
   	var poststr = "x_id=" + xid +
   			"&x_adv=" + encodeURI( document.getElementById(obj).value ) ;
      var SpanName = SpanName;             
	  makePOSTRequest('frms/adv.php', poststr, SpanName);
   }
function changepass(obj,SpanName) {
   	var poststr = "x_password=" + encodeURI( document.getElementById("x_password").value ) ;
      var SpanName = SpanName;             
	  makePOSTRequest('frms/pass.php', poststr, SpanName);
   }
function stats_ho_done(hoURL,SpanName) {
   	var curDateTime = new Date();  //For IE 
   	var poststr = "q_year=" + encodeURI( document.getElementById("x_year").value ) +
   					"&q_month=" + encodeURI( document.getElementById("x_month").value ) ;
      var SpanName = SpanName;             
	  ajaxLoad(hoURL+'?'+poststr, SpanName);
   }
   function PopupPic(sPicURL) {
     window.open( "mods/viewpic.php?"+sPicURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200");
   }
/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) - 300
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0) - 50
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlay2(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=((document.body.clientWidth)/2) - 150;
var ypos=10;
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}
