﻿/*************************************************************
INCLUDE FILE 
CREATE DATE :4:30 PM 8/28/2005
AUTHOR : PROGRAMMER MR.LE QUANG HIEU
MOBILE : 0909 325099
EMAIL  : hieulq@fpt.net OR hieulqvn@gmail.com
*************************************************************/

////////////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 bieuquyet0(QuestionId){
	var AnswerId = '';
	var height=350;
	var width=600;
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	for (i = 0; i < document.QuestionAndAnswer0.rdAnswer.length; i++){
		if (document.QuestionAndAnswer0.rdAnswer[i].checked){
			AnswerId=document.QuestionAndAnswer0.rdAnswer[i].value;
		}
	}
	if (AnswerId==''){
		alert("Bạn hãy chọn một phương án");
		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 bieuquyet1(QuestionId){
	var AnswerId = '';
	var height=350;
	var width=600;
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	for (i = 0; i < document.QuestionAndAnswer1.rdAnswer.length; i++){
		if (document.QuestionAndAnswer1.rdAnswer[i].checked){
			AnswerId=document.QuestionAndAnswer1.rdAnswer[i].value;
		}
	}
	if (AnswerId==''){
		alert("Bạn hãy chọn một phương án");
		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=350;
	var width=600;
	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);
}