﻿<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function checkLogin()
{
	window.location.href = "index.php?nav1=login";
	return false;
}
function blockVote()
{
	alert("Thời gian bình chọn sẽ bắt đầu từ ngày 16/01/2009 đến ngày 30/01/2009. Bạn nhớ quay lại sau nhé!");	
	return false;
}
// JavaScript Document
//Begin
var xmlHttp = false;
function makeRequest(url, method, respFunc, send) {
	//if(xmlHttp)
		//xmlHttp.abort();	
   	if (window.XMLHttpRequest) { // Mozilla, Safari,...
	  xmlHttp = new XMLHttpRequest();
	  if (xmlHttp.overrideMimeType) {
		 xmlHttp.overrideMimeType('text/xml');
	  }
   	} else if (window.ActiveXObject) { // IE
	  try {
		 xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	  } catch (e) {
		 try {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		 } catch (e) {}
	  }
   	}
   	if (!xmlHttp) {
	  alert('Cannot create XMLHTTP instance');
	  return false;
   	}
   xmlHttp.onreadystatechange = respFunc;
   xmlHttp.open(method, url, true);
   xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   xmlHttp.send(send);
}

function voteUp(id){
    var url = 'index.php?nav1=vote&nav2=member&video=' + id+'&kind=1';
    var send = '';
    makeRequest(url, 'POST', processVote, send);
    return false;
}
function voteDown(id){
    var url = 'index.php?nav1=vote&nav2=member&video=' + id+'&kind=0';
    var send = '';
    makeRequest(url, 'POST', processVote, send);
    return false;
}
function voteUp1(obj,id){
    var url = 'index.php?nav1=vote&nav2=member&video=' + id;
    var send = 'testid='+id+'&kind=1';
	document.getElementById('blockvote'+obj).style.visibility='hidden';
	document.getElementById('b'+obj).innerHTML='<img src="images/camp/t_vote_just.png">';
	document.getElementById('b'+obj).style.visibility='';
    makeRequest(url, 'POST', processVote1, send);
    return false;
}
function voteDown1(obj,id){
    var url = 'index.php?nav1=vote&nav2=member&video=' + id;
    var send = 'testid='+id+'&kind=0';
	document.getElementById('blockvote'+obj).style.visibility='hidden';
	document.getElementById('b'+obj).style.visibility='';
	document.getElementById('b'+obj).innerHTML='<img src="images/camp/t_vote_just.png">';
    makeRequest(url, 'POST', processVote1, send);
    return false;
}
function processVote1() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState=='complete') {
        if (xmlHttp.status == 200) {
            resp = xmlHttp.responseText;             
         }
         else
         {
         alert('Vui lòng bình chọn vào dịp khác!');
         }
     }
 }
function processVote() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState=='complete') {
        if (xmlHttp.status == 200) {
            resp = xmlHttp.responseText;             
            $('votebox').style.display= 'block';
            $('votebox').innerHTML = "<span style='color:#FF0000; font-weight:bold' class='fs3'>Bạn đã bình chọn thành công!</span>";
             
         }
         else
         {
         alert('Vui lòng bình chọn vào dịp khác!');
         }
     }
 }
 function copyclipboard(text2copy, textnote) {
	if (window.clipboardData) {
		window.clipboardData.setData("Text",text2copy);
	} else {
		var flashcopier = 'flashcopier';
		if(!document.getElementById(flashcopier)) {
			var divholder = document.createElement('div');
			divholder.id = flashcopier;
			document.body.appendChild(divholder);
		}
		document.getElementById(flashcopier).innerHTML = '';
		var divinfo = '<embed src="/skins/js/clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
		document.getElementById(flashcopier).innerHTML = divinfo;
	}
	alert(textnote);
}
function popupnew(id)
{
window.open ("popup.php?type=sanhdieu&id="+id,"mywindow","status=1,scrollbars=1,toolbar=0,resizable=0,menubar=0,width=600,height=600"); 
}
//-->

