String.prototype.trim = function() {
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
};

/*function $(Id){
	return	document.getElementById(Id);
}*/

function BoxToggle(id, total) {
	new Effect.toggle(id,'blind', {queue: 'end'});
	$(id).style.display = 'none';	
	
	/*
	var temp = $('img' + id).src;
	if (temp.substr(temp.lastIndexOf("/")+1, temp.length) =='collapse.gif') {
		$('img' + id).src = 'images/expand.gif';
		//$('img' + id).title = 'Hiển thị nội dung Box này';
		//if (hiddenNotice != '') $(hiddenNotice).style.display = '';
	} else 	{
		$('img' + id).src = 'images/collapse.gif';
		//$('img' + id).title = 'Ẩn nội dung Box này';
		//if (hiddenNotice != '') $(hiddenNotice).style.display = 'none';
	}*/
}

// showHide Panel
function showHide(panel, textPanel){
	var contentPanel = $(panel);
	var textPanel = $(textPanel);
	if (contentPanel.style.display == 'none') {
		textPanel.innerHTML = 'Hiển thị';
		contentPanel.style.display = '';
	}
	else {
		textPanel.innerHTML = 'Ẩn';
		contentPanel.style.display = 'none';
	}
}

function openPopup(url, w, h) {
	opener = window.open(url, 'openPopup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=0,dependent=no,width='+w+',height='+h);
	opener.focus();
}

function openPopup2(strHTTP, cPopupName, w, h) {
	opened = window.open(strHTTP, cPopupName,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=0,dependent=no,width='+w+',height='+h);
	opened.focus();
}

function fncDisplay(i){
	if(document.getElementById("trId_"+i).style.display == 'none'){
		document.getElementById("trId_"+i).style.display = '';
		document.getElementById("img_"+i).src = '/images/minus.gif';
	} else {
		document.getElementById("trId_"+i).style.display = 'none';
		document.getElementById("img_"+i).src = '/images/plus.gif';
	}
}

function previewSmallImg(path){
	img_preview = document.getElementById("imgSmallPreview")
	img_list = document.getElementById("small_image_list")
	img_preview.src = path + img_list.options[img_list.selectedIndex].text;
}
function previewLargeImg(path){
	img_preview = document.getElementById("imgLargePreview")
	img_list = document.getElementById("large_image_list")
	img_preview.src = path + img_list.options[img_list.selectedIndex].text;
}
function isNumeric(sText) {
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1)
			IsNumber = false;
	}
	return IsNumber;
}

function deletecheck(){
	if(confirm('Are you sure want to delete?')){
		return true;
	}else{
		return false;
	}
}
function redirect(URLStr) { 
	location = URLStr; 
}
function jumpPage(obj, page) {
		var urltemplate = page + obj.options[obj.selectedIndex].value;
		if (obj.selectedIndex != -1) 
			top.location.href = urltemplate;
		return 1;
}
