﻿function modalDialog(URL,title,width,height){
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	
	window.showModalDialog(URL, title, "dialogHeight: " + height + "px; dialogWidth: " + width + "px; dialogTop: " + top + "px; dialogLeft: " + left + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scrollbar: No");
}
function changeto(obj,strclass){
	if(strclass!=''){
		obj.className = strclass;
	}
}
function dropCategory(hlink,obj,numofsub){
	if(numofsub>0){
		if(obj.className == 'on'){
			obj.className = 'off';
			document.frmTemp.objdrop.value='';
		}else{
			obj.className = 'on';
			if(document.frmTemp.objdrop.value!=''){
				identity = document.getElementById(document.frmTemp.objdrop.value);
				identity.className = 'off';
			}
			document.frmTemp.objdrop.value = obj.id;
		}
	}
	if(hlink!=''){
		location.href = hlink;
	}
}
var isIE = (document.getElementById && document.all);
function openImage(vLink, vHeight, vWidth)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;
	if (sLink == '')
	{
		return false;
	}
	winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	newwin = open('', '_blank', winDef);
	newwin.document.writeln('<title>Xem ảnh</title>');
	newwin.document.writeln('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="', (isIE) ? '' : '', '" border=0 title=\'Đóng lại\'></a>');
	newwin.document.writeln('</body>');
	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}
////////////VAR/////////////////////////////////////
var pop;
////////////////////////////////////////////////////

function movePage(page){
	if(!isNaN(page)){
		document.frmMovePage.Page.value = page;
		document.frmMovePage.submit();
	}
}

function checkSearchDate(frm){
	var day = frm.SDay.value;
	var month = frm.SMonth.value;
	var year = frm.SYear.value;
	
	if(day == ""&&month == ""&&year == ""){
		alert("Bạn phải nhập ngày hoặc tháng hoặc năm");
		return false;
	}
	return true;
}

function changeto(obj,strclass){
	if(strclass!=''){
		obj.className = strclass;
	}
}
function dropCategory(hlink,obj,numofsub){
	if(numofsub>0){
		if(obj.className == 'on'){
			obj.className = 'off';
			document.frmTemp.objdrop.value='';
		}else{
			obj.className = 'on';
			if(document.frmTemp.objdrop.value!=''){
				identity = document.getElementById(document.frmTemp.objdrop.value);
				identity.className = 'off';
			}
			document.frmTemp.objdrop.value = obj.id;
		}
	}
	if(hlink!=''){
		location.href = hlink;
	}
}
function modalDialog(URL,title,width,height){
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	
	window.showModalDialog(URL, title, "dialogHeight: " + height + "px; dialogWidth: " + width + "px; dialogTop: " + top + "px; dialogLeft: " + left + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scrollbar: No");
//	window.open(URL,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=" + width + ", height=" + height)
//	if(strAlert != null && strAlert != ""){
//		alert(strAlert);
//	}
}
function bieuquyet(QuestionId){
	var AnswerId = '';
	var height=300;
	var width=550;
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	for (i = 0; i < document.QuestionAndAnswer.rdAnswer.length; i++){
		if (document.QuestionAndAnswer.rdAnswer[i].checked){
			AnswerId=document.QuestionAndAnswer.rdAnswer[i].value;
		}
	}
	if (AnswerId==''){
		alert("Check any answer, please !");
		return false;
	}
	else
	{
		url="BieuQuyet.asp?AnswerId="+AnswerId+"&QuestionId="+QuestionId;
		window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, left=" + left + ", top=" + top + ", width=" + width + ", height=" + height)
		
	}
}
function xembieuquyet(QuestionId){
	var height=300;
	var width=550;
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
		url="XemBieuQuyet.asp?QuestionId="+QuestionId;
		window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, left=" + left + ", top=" + top + ", width=" + width + ", height=" + height)
		
	return true;
}
//////////////////////////////VIEW IMAGES NEW DETAILT////////////////////////////////////////
function openwindow(url,width,height)
{
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	if((pop!=null)&&(!pop.closed)){
		pop.close();
	}
	pop = window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no,left=" + left + ", top=" + top + ", width=" + width + ", height=" + height)
}

function openwindow1(url,width,height)
{
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	
	window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no,left=" + left + ", top=" + top + ", width=" + width + ", height=" + height)
}


function openwindowfull(url)
{
	window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, fullscreen=yes")
}

function gen_Image(w,Thumb_W,Thumb_H,Full_W,Full_H,Photo, TDesc,TSize,TAlign){
var szHTML, tf, it;

	if (TSize == 0){
		it = '<a href="JavaScript:void(0)" onClick=\"JavaScript:openwindow(\'' + Photo + '.jpg\',\'' + (parseInt(Full_W)) + '\',\'' + (parseInt(Full_H)) + '\')\"><img src="' + Photo + '_T.jpg" border="0" alt="' + TDesc + '"></a>';
	}
	else{
		it = '<!--SP--><img src=' + Photo + '.jpg border="0" alt="' + TDesc + '"><!--EP-->';
	}

	szHTML='';
	szHTML+='<table cellSpacing=0 cellPadding=3 width=1 align=' + TAlign + ' border=0>';
	szHTML+='<tr><td>';
	szHTML+= it;
	szHTML+='</td></tr>';
	if(TDesc!=''){
		szHTML+='<!--SD--><tr><td align="center"><span style="font-family:Verdana;font-size:7pt">' + TDesc + '</span></td></tr><!--ED-->';
	}
	szHTML+='</table>';
	
	return szHTML;	
}
function Viewer(path, x, y)
{
	var a = window.open('view.htm?' + path,"n","width=" + x + ",height=" + y);
}