var USER_AGENT 		= navigator.userAgent.toLowerCase();
var IS_OPERA 		= (USER_AGENT.indexOf('opera') != -1);
var IS_SAFARI 		= ((USER_AGENT.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.'));
var IS_IE		= ((USER_AGENT.indexOf('msie') != -1) && !IS_OPERA && !IS_SAFARI);
var IS_IE7		= false;
var IS_IE6		= false;
if (IS_IE) {
	if (!IS_OPERA && window.XMLHttpRequest) IS_IE7 = true;
	else IS_IE6 = true;
}
var IS_MOZILLA		= ((navigator.product == 'Gecko') && !IS_SAFARI);
var IS_KONQUEROR	= (USER_AGENT.indexOf('konqueror') != -1);
/*
**	RE-ARRANGE MENU
*/


/*
**	DEFINE MENU LAYOUT: STUP
*/
function switchButtonStyle(obj,className){
	if(className.indexOf("Over")!=-1){
			tmpclass=className.substr(0,className.indexOf("Over"));
	}else{
			tmpclass=className+"Over";
	}
	if(IS_IE){
		if(tmpclass==obj.className){
				obj.className=className;
		}

	}else{
		if(tmpclass==obj.getAttribute('class')){
			obj.setAttribute('class',className);
		}
	}
}
function switchOnMenu(obj){
	imgurl=obj.src;
	if(imgurl.indexOf("_off")!=-1){
		obj.src=imgurl.replace("_off","_on");
	}
}
function switchOffMenu(obj){
	imgurl=obj.src;
	if(imgurl.indexOf("_on")!=-1){
	 obj.src=imgurl.replace("_on","_off");
	}
}


//TaiDP Begin
function resizeButton(idx){
    for(j=0;j<idx*1;j++){
	if(document.getElementById('box'+j)!=null){
		document.getElementById('button'+j).style.width=document.getElementById('box'+j).offsetWidth;
	}
	}
}
function showCurrentTab(tabObject){
	location.href(tabObject);
}

function replaceAll(strChk, strFind, strReplace) {
  var strOut = strChk;
  while (strOut.indexOf(strFind) > -1) {
    strOut = strOut.replace(strFind, strReplace);
  }
  return strOut;
}

function trim(s) {
    var i, sRetVal = "";
    i = s.length - 1;
    while ((i >= 0) && (s.charAt(i) == ' ')) {
        i--;
    }
    s = s.substring(0, i + 1); // trim blanks on the right
    i = 0;
    while ((i < s.length) && (s.charAt(i) == ' ')) {
        i++;
    }
    return s.substring(i);
}

function controlAction(action){
	document.web.action=action;
	document.web.submit();
}
function redirectToCommand(action,URL,isCheck){
	document.web.action = URL;
	if (isCheck){
		document.web.action = action;
		document.getElementById("URLRedirect").value = URL;
	}
	document.web.submit();

}

function showHelpExtends(dialogName){
    widthOpen = (screen.width/2)-(700/2);
	heightOpen = (screen.height/2)-(500/2);
	my_window= window.open(dialogName,'Help','width=700,heigh=500,resizable=1,scrollbars=1,top='+heightOpen+',left='+widthOpen);
	return my_window;
}

function alertDialogExtend(text,height,width){
	height = height + 50;
	dialogSize = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;center:1;resizable:1;status:1";
//20070626_TuanTT_Modify (for FireFox compatibility)
	if (window.showModalDialog) {
		return window.showModalDialog("AlertDialogView",text,dialogSize);
	} else {
		text=text.replace(/<br>/g,'\n');
		alert(text);
	}

	//return window.showModalDialog('AlertDialogView',text,dialogSize);
}

function confirmDialogExtend(dialog,text,width,height){
	height = height + 50;
	dialogSize = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;center:1;resizable:1;status:1";
//20070626_TuanTT_Modify (for FireFox compatibility)
	if (window.showModalDialog) {
		return window.showModalDialog('ConfirmDialogView',text,dialogSize);
	} else {
		text=text.replace(/<br>/g,'\n');
		confirm(text);
	}
	//return window.showModalDialog('ConfirmDialogView',text,dialogSize);
}
function alertDialogExtendSEO(text,height,width,siteName){
	viewName = siteName + '/servlet/AlertDialogView';
	height = height + 50;
	dialogSize = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;center:1;resizable:1;status:1";
//20070626_TuanTT_Modify (for FireFox compatibility)
	if (window.showModalDialog) {
		return window.showModalDialog(viewName,text,dialogSize);
	} else {
		text=text.replace(/<br>/g,'\n');
		alert(text);
	}

	//return window.showModalDialog('AlertDialogView',text,dialogSize);
}

function confirmDialogExtendSEO(dialog,text,width,height,siteName){
	viewName = siteName + '/servlet/ConfirmDialogView';
	height = height + 50;
	dialogSize = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;center:1;resizable:1;status:1";
//20070626_TuanTT_Modify (for FireFox compatibility)
	if (window.showModalDialog) {
		return window.showModalDialog(viewName,text,dialogSize);
	} else {
		text=text.replace(/<br>/g,'\n');
		confirm(text);
	}
	//return window.showModalDialog('ConfirmDialogView',text,dialogSize);
}
/**
 * Set Focus Object
 */
function setFocus(obj){
	event.returnValue=false;
	obj.focus();
}

function viewArticleDetail(catEntryId,quantity){
	URLDetail = "ArticleDetailsDisplayCmd?catEntryId=" + catEntryId + "&txtQty=" + quantity;
	location.href(URLDetail);
}

function aloDialog(){
	if (window.showModalDialog){
		resultText = window.showModalDialog('AloDialogView','','dialogWidth:455px;dialogHeight:410px;center:1;resizable:0;status:1;scroll:0');
		if (typeof resultText == 'undefined')return;
		nextLink = "AloDirectCmd?txtContent="+resultText;
		window.showModalDialog(nextLink,'','dialogWidth:400px;dialogHeight:205px;center:1;resizable:0;status:1;scroll:0');
	}
	else {
		window.open("AloDialogView","","height=410px,width=455px,status=yes,toolbar=no,menubar=no,location=no");
	}
}
 //TaiDP End


//VinhNX Begin
<!--

function utf8(wide) {
  var c, s;
  var enc = "";
  var i = 0;
  while(i<wide.length) {
    c= wide.charCodeAt(i++);
    // handle UTF-16 surrogates
    if (c>=0xDC00 && c<0xE000) continue;
    if (c>=0xD800 && c<0xDC00) {
      if (i>=wide.length) continue;
      s= wide.charCodeAt(i++);
      if (s<0xDC00 || c>=0xDE00) continue;
      c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000;
    }
    // output value
    if (c<0x80) enc += String.fromCharCode(c);
    else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
    else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
    else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));
  }
  return enc;
}

var hexchars = "0123456789ABCDEF";

function toHex(n) {
  return hexchars.charAt(n>>4)+hexchars.charAt(n & 0xF);
}

var okURIchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";

function encodeURIComponentNew(s) {
  var s = utf8(s);
  var c;
  var enc = "";
  for (var i= 0; i<s.length; i++) {
    if (okURIchars.indexOf(s.charAt(i))==-1)
      enc += "%"+toHex(s.charCodeAt(i));
    else
      enc += s.charAt(i);
  }
  return enc;
}

function buildURL(fld)
{
	if (fld == "") return false;
	var encodedField = "";
	var s = fld;
	if (typeof encodeURIComponent == "function")
	{
		// Use JavaScript built-in function
		// IE 5.5+ and Netscape 6+ and Mozilla
		encodedField = encodeURIComponent(s);
	}
	else
	{
		// Need to mimic the JavaScript version
		// Netscape 4 and IE 4 and IE 5.0
		encodedField = encodeURIComponentNew(s);
	}

	return encodedField;
}
// -->

function confirmDialogAddToCart(dialog, text){
	if (window.showModalDialog) {
		return window.showModalDialog(dialog,text,'dialogWidth:570px;dialogHeight:250px;center:1;resizable:1;status:0;scroll:0');
	} else {
		return confirm(text[0]+" "+text[5]+". "+text[9]);
	}
}

 function validateEmail(email){
		var mailRegExp = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
		if (email!=""){
			if (!mailRegExp.test(email)){
		  		return false;
		  	}
 	    }
 	    return true;
 }

function selectOptionByValue(selectId, optionValue){
	obj = document.getElementById(selectId);
	for (j=0;j<obj.options.length;j++){
		if (obj.options[j].value == optionValue){
			 obj.selectedIndex = j;
			 return;
		}
	}
}

function optionSelected(selectId, optionText){
 	objSelect = document.getElementById(selectId);
 	for (i=0;i<objSelect.length;i++){
 		if (objSelect.options[i].text == optionText){
 			objSelect.options[i].selected = true;
 			return;
 		}
 	}
}

function textboxFocus(objId){
	obj = document.getElementById(objId);
	obj.select();
}
function checkSm(e, obj, alertStr, strSearchId, docAccId, storeId, langId){
	var eventInstance = window.event ? event : e;
	var keyCodeEntered = eventInstance.charCode ? eventInstance.charCode : eventInstance.keyCode;
    if (keyCodeEntered == 13){
	 	if(obj.value!='') doSearchArticle(alertStr, strSearchId, docAccId, storeId, langId, e);
    }
}
function checkSmSEO(e, obj, alertStr, strSearchId, docAccId, storeId,siteName){
	var eventInstance = window.event ? event : e;
	var keyCodeEntered = eventInstance.charCode ? eventInstance.charCode : eventInstance.keyCode;
    if (keyCodeEntered == 13){
	 	if(obj.value!='') doSearchArticleSEO(alertStr, strSearchId, docAccId, storeId,siteName);
    }
}
function doSearchArticle(alertStr, strSearchId, docAccId, storeId, langId, e){
	if(document.getElementById(strSearchId).value==""){
		alertDialog(alertStr);
		return;
	}else{
		callSearch = "SearchArticleCmd?storeId="+storeId+"&langId="+langId+"&strSeachValue=";
		strSearch = buildURL(document.getElementById(strSearchId).value);
		callSearch += strSearch;
		if (document.getElementById(docAccId).checked){
			callSearch += "&documentAssocie=true";
		}
		if (window.event)
			event.returnValue = false;
		else
			e.preventDefault();
		window.location.href = callSearch;
		return false;
	}
}
function doSearchArticleSEO(alertStr, strSearchId, docAccId, storeId,siteName){
	if(document.getElementById(strSearchId).value==""){
		alertDialogSEO(alertStr,siteName);
		return;
	}else{
		callSearch = siteName + "/servlet/SearchArticleCmd?storeId="+storeId+"&strSeachValue=";
		strSearch = buildURL(document.getElementById(strSearchId).value);
		callSearch += strSearch;
		if (document.getElementById(docAccId).checked){
			callSearch += "&documentAssocie=true";
		}
		location.href = callSearch;
	}
}
//VinhNX End

//DanhHT Begin
function setCookie(name,value) {
	document.cookie = name + "=" +escape( value );
}

function getCookie(name){
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && name != document.cookie.substring( 0, name.length ) ) {
		return null;
	}
	if ( start == -1 ) return null;
		var end = document.cookie.indexOf( ";", len );
	if ( end == -1 )
		end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );


}

function confirmDialog(dialog,text){
//20070626_TuanTT_Modify (for FireFox compatibility)
	if (window.showModalDialog) {
		return window.showModalDialog('ConfirmDialogView',text,'dialogWidth:560px;dialogHeight:220px;scroll:0;center:1;resizable:0;status:1;');
	} else {
		text=text.replace(/<br>/g,'\n');
		return confirm(text);
	}
}
function stockDialog(){
	if (window.showModalDialog) {
		return window.showModalDialog("StockDialogView","","dialogWidth:560px;dialogHeight:290px;status:1;scroll:0;center:1;resizable:0;");
	} else {
		text=text.replace(/<br>/g,'\n');
		return window.open("StockDialogView");
	}

}

function alertDialog(text){
//20070626_TuanTT_Modify (for FireFox compatibility)
	if (window.showModalDialog) {
		//return window.open('AlertDialogView');
		return window.showModalDialog("AlertDialogView",text,"dialogWidth:560px;dialogHeight:220px;status:1;scroll:0;center:1;resizable:0;");
	} else {
		text=text.replace(/<br>/g,'\n');
		return alert(text);
	}

}
function confirmDialogSEO(dialog,text,siteName){
//20070626_TuanTT_Modify (for FireFox compatibility)
	viewName = siteName + '/servlet/ConfirmDialogView';
	if (window.showModalDialog) {
		return window.showModalDialog(viewName,text,'dialogWidth:560px;dialogHeight:220px;scroll:0;center:1;resizable:0;status:1;');
	} else {
		return confirm(text);
	}
}


function alertDialogSEO(text,siteName){
//20070626_TuanTT_Modify (for FireFox compatibility)
	viewName = siteName + '/servlet/AlertDialogView';
	if (window.showModalDialog) {
		//return window.open('AlertDialogView');
		return window.showModalDialog(viewName,text,"dialogWidth:560px;dialogHeight:220px;status:1;scroll:0;center:1;resizable:0;");
	} else {
		return alert(text);
	}

}
function MouseMove(obj,url){
	obj.src=url;
}
function MouseOut(obj,url){
	obj.src=url;
}
function cmdExpressTab2(tabOn,tabOff, tabOnButtonName, tabOffButtonName){
 	if(document.getElementById(tabOn).style.display=='none'){
		document.getElementById(tabOn).style.display='block';
		document.getElementById(tabOff).style.display='none';
		document.getElementById(tabOffButtonName).className="buttonSaisirGrey";
		document.getElementById(tabOnButtonName).className="buttonSaisirBlack";
	}
	//WCF Comments : in case tab Saisir is selected
	if(tabOn=='cmdExpressDiv1'){
		setCookie('tabCommandExpressSelected','saisir');
		//WCF Comments : Clear Data in tab Copier;
		document.getElementById("txtPartNumQty").value="";

	}else{
		setCookie('tabCommandExpressSelected','copier');
		//WCF Comments : Clear Data in tab Saisir;
		for(i=0;i<=4;i++){
			document.getElementById("txtPartNumber"+i).value="";
			document.getElementById("txtQuantityDemand"+i).value="";
		}
	}


}



function enableSearch(cond){
	if(document.getElementById("search_section")!=null){
	if(cond){
		/*document.getElementById("haleco_ico").style.visibility='visible';*/
		document.getElementById("search_section").style.display='block';
		document.getElementById("searchBoxTR").style.display='block';
	}else{
		/*document.getElementById("haleco_ico").style.visibility='hidden';*/
		document.getElementById("search_section").style.display='none';
		document.getElementById("searchBoxTR").style.display='none';
	}
	}
}

 function cmdExpressTabIndexSEO(storeId,catalogId,langId,siteName){
	location.href=siteName +"/servlet/" + "PageAccueil?storeId="+storeId + "&catalogId=" + catalogId +"&langId="+ langId;
	setCookie('tabSelected','index');
 }

 function cmdExpressTab(obj,tabOn,tabOff,btOff,onImg,offImg){
 	if(document.getElementById(tabOn).style.display=='none'){
		document.getElementById(tabOn).style.display='block';
		document.getElementById(tabOff).style.display='none';
		obj.className=onImg;
		document.getElementById(btOff).className=offImg;

	}
	if(tabOn=='indexBrowse'){
		setCookie('tabSelected','index');
	}else{
		setCookie('tabSelected','category');
	}
 }
 // WCS-Commnent: Change page size when user selelect a new value in dropdown list
function goToPage(command,step){
	currrentPage=parseInt(document.web.currentPage.value);
	totalPages=document.getElementById("totalPages").value;
	nextPage=currrentPage+step;
	if(nextPage>=0 && nextPage<totalPages*1){
		document.web.action=command;
		document.web.currentPage.value=nextPage;
		document.web.submit();
	}

}
/*
** JUMB TO ONE PAGE
*/
function allezPage(command,msg){
	topage=document.getElementById("gotopage").value;
	totalPages=document.getElementById("totalPages").value;
	if(isInteger(topage)){
		if(topage*1<1 || topage*1>totalPages*1){
			alertDialog(msg);
		}else{
			document.web.action=command;
			document.web.currentPage.value=topage-1;
			document.web.submit();
		}
	}else{
		alertDialog(msg);
	}
}
function endPage(command,cond){
	totalPages=document.getElementById("totalPages").value;
	/*
	** MOVE TO FIRST PAGE
	*/
	if(cond==1){
			document.web.action=command;
			document.web.currentPage.value=0;
			document.web.submit();
	}else{
	/*
	**	MOVE TO LAST PAGE
	*/
			document.web.action=command;
			document.web.currentPage.value=totalPages*1-1;
			document.web.submit();

	}

}
function cacherImages(obj){

	cols=document.getElementsByTagName("img");
	if(obj.checked){
		for(i=0;i<cols.length;i++){
			if(cols[i].id.substring(0,11)=='PRODUCT_IMG'){
				cols[i].style.display='none';
			}
		}
	}else{
		for(i=0;i<cols.length;i++){
			if(cols[i].id.substring(0,11)=='PRODUCT_IMG'){
				cols[i].style.display='inline';
			}
		}
	}
}
// WCS-Commnent: Apply sorting when user click on corresponding icon
function makeSort(sortBy,sortType,command){
	document.web.action=command;
	document.web.sortBy.value=sortBy;
	document.web.sortType.value=sortType;
	document.web.currentPage.value='0';
	document.web.submit();
}
function changePageNumber(command,pageNumber,totalPage){
	document.web.action=command;
	document.web.currentPage.value=pageNumber;
	document.web.submit();

}
function changePage(command){
	document.web.action=command;
	document.web.currentPage.value='0';
	document.web.submit();
}
function addIntoPreConfigList(obj,sku,errorMsg){
	if(isInteger(document.getElementById(obj).value)){
		url='PreconfigListDisplayCmd?preId=-1&';
		url+='txtQuantity='+document.getElementById(obj).value+'&';
		url+='txtRef='+sku+'&';
		location.href=url;
	}else{
		alertDialog(errorMsg);
		document.getElementById(obj).focus();
	}
}
function addToCart(url,obj,msg,sku,type){
	qty=document.getElementById(obj).value;
	if(isInteger(qty) && qty!="0"){
		url=url+'&txtQty='+qty+'&catEntryId='+sku;
		document.web.action=url;
		document.web.submit();
	}else{
		if(qty==""){
			alertDialog(msg);
		}else{
			alertDialog(invalid_number);
		}
		document.getElementById(obj).focus();

	}

}
function addConfigList(url,obj,msg,sku,type){
	qty=document.getElementById(obj).value;
	if(isInteger(qty)){
		if(type==1){
			url=url+'&ddqty='+qty+'&productId='+sku;
			document.technico.action=url;
		}else{
			s=obj.replace("intQuantity","txtQty");
			document.technico.action="MesListeDisplayCmd";
			document.getElementById(s).value=qty;
		}
		document.technico.submit();
	}else{
		alertDialog(msg);
		document.getElementById(obj).focus();

	}
}
function isInteger(str){
	 var anum=/(^\d+$)|(^\d+\d+$)/
	 if (anum.test(str)){
	 	return true;
	 }else{
		 return false;
	 }
 }
 function compareItems(url,ERR_MESSAGE){
  count=0;
  cols=document.getElementsByTagName("input");
  for(i=0;i<cols.length;i++){
	  if(cols[i].attributes['type'].value.toLowerCase()=='checkbox'){
	  	 if(cols[i].id.match("strRefCode")){
		 if(cols[i].checked) count++;
		 }
	  }
  }
  if(count<2 || count>4){
	  alertDialog(ERR_MESSAGE);
	  return;
  }else{
	  document.web.action=url;
	  document.web.submit();
  }
 }

function tabShow(){

	if(getCookie('tabSelected')!=null && getCookie('tabSelected')=='index'){
		ob=document.getElementById("brs1");
		if(ob!=null){
			cmdExpressTab(ob,'indexBrowse','catalogueBrowse','brs0','categoriesButton','indexButton');
		}
	}else{
		ob=document.getElementById("brs0");
		if(ob!=null){
			cmdExpressTab(ob,'catalogueBrowse','indexBrowse','brs1','categoriesButton','indexButton');
		}
	}
	document.getElementById("indexCatBox").style.display='block';


}
//DanhHT End

//NhonNT begin
function showHelpwindow(text){
    links = (screen.width/2)-(700/2);
	oben = (screen.height/2)-(500/2);
	if(text=='CGV'){
		my_window= window.open('Institutionnelles?page=espinfo_Ser_CGV.jsp',text,'width=700,heigh=500,resizable=1,scrollbars=1,top='+oben+',left='+links);
	}else{
		my_window= window.open('InstitutionnellesPopup?page=Aide_generale.jsp',text,'width=700,heigh=500,resizable=1,scrollbars=1,top='+oben+',left='+links);
	}
	return my_window;
}

//NhonNT end

//QuyLD Begin
function panierDialog(dialog,text){

    if (window.showModalDialog) {
		return window.showModalDialog('PanierDialogView',text,'dialogWidth:630px;dialogHeight:230px;center:1;resizable:0;status:1;');
	} else {
		return confirm(text);
	}

//	return window.showModalDialog('PanierDialogView',text,'dialogWidth:630px;dialogHeight:230px;center:1;resizable:1;status:0;');
}

//WCF Comments : QuyLD Modify
function setCurrentTab(obj){
	imgurl=obj.src;
	//if(imgurl.indexOf("_off")!=-1){
	//	obj.src=imgurl.replace("_off","_on");
	//}

	setCookie('tabSegmentSelectedImage',imgurl);
	setCookie('tabSegmentSelectedID',obj.id);
}

function getCommande(url){
 	return url.substring(url.lastIndexOf('/')+1,url.length);
 }
function setCurrentPage(obj){
	if(document.getElementById(obj)!= null || document.getElementById(obj)!= undefined){
		document.getElementById(obj).className='currentPage';
	}
}
function wishListDialog(dialog,text){
	if (window.showModalDialog) {
		return window.showModalDialog('WishListDialogView',text,'dialogWidth:560px;dialogHeight:220px;center:1;resizable:0;status:1;');
	} else {
		return confirm(text);
	}

	//return window.showModalDialog('WishListDialogView',text,'dialogWidth:560px;dialogHeight:170px;center:1;resizable:1;status:0;');
}

function clearTabSelected(){

	if(getCookie('tabCommandExpressSelected')!=null){
		deleteCookie("tabCommandExpressSelected");
	}

	if(getCookie('tabSelected')!=null){
		deleteCookie("tabSelected");
	}
	if(getCookie('tabSegmentSelectedImage')!=null){
		deleteCookie("tabSegmentSelectedImage");
	}
	if(getCookie('tabSegmentSelectedID')!=null){
		deleteCookie("tabSegmentSelectedID");
	}



}

function deleteCookie (cookieName )
{
  var cookieExpireDate = new Date ( );  // current date & time
  cookieExpireDate.setTime (cookieExpireDate.getTime() - 1 );

  document.cookie = cookieExpireDate += "=; expires=" + cookieExpireDate.toGMTString();

}




function showTab(){



	if(getCookie('tabCommandExpressSelected')!=null && getCookie('tabCommandExpressSelected')=='copier'){
		//ob=document.getElementById("brs1");
		//if(ob!=null){
			cmdExpressTab2('cmdExpressDiv2','cmdExpressDiv1','btCopier','btSaisir');

		//}
	}else{
		//ob=document.getElementById("brs0");
		//if(ob!=null){
			cmdExpressTab2('cmdExpressDiv1','cmdExpressDiv2','btSaisir','btCopier');
		//}
	}
}

function showSegmentTab(){


	if(getCookie('tabSegmentSelectedImage')!=null){
		imgurl=getCookie('tabSegmentSelectedImage');
		id=getCookie('tabSegmentSelectedID');


		document.getElementById(id).src=imgurl.replace("_off","_on");

		if (IS_IE){
			document.getElementById(id).disabled=true;
		}
		else{

			document.getElementById(id).onmouseout=doNothing;
		}




	}
}
function doNothing(){
	return false;
}



function showPolicyModify(notautho,storeId,text,flag,callerURL){
 	//alert(notautho);
 	if(notautho!=""){
	 	var rs= confirmDialogPolicy(text);
			if(rs==1 && flag==1){
				document.location.href="LoginDisplayCmd?storeId="+storeId;
				return;
			}else if(rs==1 && flag==2){
				document.location.href="LoginDisplayCmd?storeId="+storeId+"&URL="+callerURL;
				return;
			}
	}
}
//QuyLD End

//BachNT Begin

//BachNT End

//TuanTT Begin

//TuanTT End
//NhonNT Begin
function showAlertRequiredField(text)
{
	alertDialogExtend(text,210,410);
}

function confirmDialogPolicy(text){
	if (window.showModalDialog) {
		return window.showModalDialog('ConfirmDialogPolicyView',text,'dialogWidth:450px;dialogHeight:205px;center:1;resizable:1;status:0;scroll:0');
	}else{
		return confirm(text);
	}
}

function showPolicy(notautho,storeId,text,flag){
 	//alert(notautho);
 	if(notautho!=""){
	 	var rs= confirmDialogPolicy(text);
			if(rs==1 && flag==1){
				document.location.href="RegisterSocieteView?storeId="+storeId;
				return;
			}else if(rs==1 && flag==2){
				document.location.href="LoginDisplayCmd?storeId="+storeId;
				return;
			}
	}
}



//check valid phone , fax number base on language
function isValidPhoneNumber(str,langID){
	 //rePhoneNumber = new RegExp(/^((\d)*(\s)*(\d)*)*$/)
	 rePhoneNumber = new RegExp(/^(\d)*$/)
	 var maxLength;
	 if(langID==-2){
	 	maxLength=10;
	 }else{
	 	maxLength=9;
	 }
	 var strtemp=trim(str);
	 if(strtemp.indexOf("0033")>=0 || strtemp.indexOf("0034")>=0 || strtemp.indexOf("0035")>=0){
	 	maxLength=maxLength+4;
	 }
	 //remove check maxLength
	 if (rePhoneNumber.test(strtemp)){
	 	return true;
	 }else{
		return false;
	 }
}
//NhonNT End


