/**
##
#	Project: PHPDisk
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: common.js 7 2010-08-24 01:26:46Z along $
#
#	Copyright (C) 2008-2009 PHPDisk Team. All Rights Reserved.
#
##
*/
function g(id){
	return document.getElementById(id);	
}
String.prototype.strtrim = function(){
	return this.replace(/(^\s*)|(\s*$)/g, "");
}
function go(url){
	document.location = url;
}
function createHttpRequest(){
	var xmlhttp;
	try{
		xmlhttp = new XMLHttpRequest();
		if(xmlhttp.overrideMimeType){
			xmlhttp.overrideMimeType('text/xml');	
		}	
	}catch(e){
		try{
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
		}catch(e){
			try{
				xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
			}catch(e){
				alert('Ajax error!');			
			}	
		}	
	}
	return xmlhttp;
}
function active_account(){
	var xmlhttp = createHttpRequest();
	g('verifying').innerHTML = "<img src='images/ajax_loading.gif' align='absmiddle' border='0' />处理中...";
	xmlhttp.open("get","ajax.html?action=active",true);
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
			if(xmlhttp.responseText =='true'){
				g('verifying').innerHTML = '';
				alert('激活邮件已发送到您的邮箱中，请查收。');
			}else{
				alert('无法发送激活邮件，请联系管理员。');
			}
		}
	}
	xmlhttp.send(null);
}
function resize_img(id,w,h){
	if(g(id).width>w){
		g(id).width = w;
	}
	if(g(id).height>h){
		g(id).height = h;
	}
}

function reverse_ids(id){
	for (var i=0;i<id.length;i++) {
		var ids = id[i];
		ids.checked = !ids.checked;
	}
}
function cancel_ids(id){
	for (var i=0;i<id.length;i++) {
		var ids = id[i];
		ids.checked = false;
	}
}
function checkbox_ids(ids){
	var n = document.getElementsByName(ids);
	var j = 0;
	for(i = 0; i < n.length; i++){
		if(n[i].checked){
			j++;
		}
	}
	if(j ==0){
		return false;
	}else{
		return true;
	}
}

