﻿var ajax;

function createRequestObject() {
var ro;
var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
	    ro = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
	    ro = new XMLHttpRequest();
	}
return ro;
}

var http = createRequestObject();
	
function ajx_action(action,id_name) {
    ajax = id_name;
    //alert(ajax);

    var browser = navigator.appName;
    /*
	if(browser == "Microsoft Internet Explorer"){
	    http.open('POST', action);
	}else{
	    http.open('GET', action);
	}
	*/

    http.open('GET', action);
    http.onreadystatechange = ajx_handleResponse;
    http.send(null);
}
function ajx_handleResponse() {
    //alert(ajax);
    if(http.readyState == 4){
        var response = http.responseText;
        var idd_name = ajax;
        document.getElementById(idd_name).innerHTML = response;
    }
    return true;
}


function _winopen(){     
	var i;
	var itemvalue;
	
	itemvalue=0;	
	for (i=0;i<document.vote.VoteItem.length;i++)
	{	
		if (document.vote.VoteItem[i].checked)
		{
			itemvalue=document.vote.VoteItem[i].value;    
			document.vote.VoteItem[i].checked = false;
			break;
		}
	}
	window.open("vote.asp?VoteID=" + document.vote.VoteID.value + "&VoteItem=" + itemvalue, "Ket_qua_tham_do_du_luan", "toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=400,height=260")
}
function popup(filename,imageName,imageWidth,imageHeight)
	{
		window.open(filename + '?image=' + imageName + '','View','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + imageWidth + ',height=' + imageHeight + '')
	}
function winpopup(filename,imageName,imageWidth,imageHeight)
	{
		window.open(filename + '?param=' + imageName + '','View','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + imageWidth + ',height=' + imageHeight + '')
	}
	
// Javascript hien thi Image dung kich co cua cua so Popup.
function openImage(ImageName) {
  PopUpWindow=window.open("","ImagePreview","status=no,resizable=no,width=90,height=110,top=10,left=10");     
  	  // open the new window with just the title and status bar and name it 'PopUpWindow'
  PopUpWindow.document.writeln('<html>');
  PopUpWindow.document.writeln('<head>');
  PopUpWindow.document.writeln('<title>www.vnmedia.vn</title>');   
  	  // put the name of the pic in the title bar
  PopUpWindow.document.writeln('</head>');

  if (navigator.appName == "Microsoft Internet Explorer") 
  	  // in IE resizeTo give the outer of the window
     PopUpWindow.document.writeln('<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" onLoad="window.resizeTo(document.images[0].width+20,document.images[0].height+ 40)">');   
		      // resize the window to match the picture

   else
       PopUpWindow.document.writeln('<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" onLoad="window.resizeTo(document.images[0].width,document.images[0].height+ 20)">');   
          // resize the window to match the picture
  PopUpWindow.document.writeln('<center><a href="/" onClick=window.close()><img src="'+ImageName+' " border="0">');
  PopUpWindow.document.writeln("</body></html>");

// load the image in the window
  PopUpWindow.document.writeln('</body>');
  PopUpWindow.document.writeln('</html>');
  PopUpWindow.document.close();
  PopUpWindow.focus();  // place the window in front
}