////winopen
function openWin(url, width, height){
	try{
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	var param = 'resizable=0, scrollbars=yes, width=' + width + ', height=' + height + ', left=' + left + ', top=' + top;
	window.open(url, '_blank', param);
	}catch(e){
	;
	}
	return false;
}
function showMenu(aobj){
	openWin(aobj.href, 620, 450);
	return false;
}
function showPicture(aobj){
	openWin(aobj.href, 620, 450);
	return false;
}
function showNews(aobj){
	openWin(aobj.href, 620, 450);
	return false;
}

////write comment
function openCmtForm(a,b){
  var aa=document.getElementById(a);
  var bb=document.getElementById(b)
  aa.style.display="none";
  bb.style.display="block";
}
function closeCmtForm(a,b){
  var aa=document.getElementById(a);
  var bb=document.getElementById(b)
  aa.style.display="block";
  bb.style.display="none";
}

//addComment
function addComment(form){
    form.send.disabled = true;
    var postEmail=form.postEmail.value;
    var postContent=form.postContent.value;
    if (postEmail==null||postEmail==''){
        alert("Please type your email");
        form.postEmail.focus();
        form.send.disabled = false;
        return false;
    }
    if (postContent==null||postContent==''){
        alert("Please type content");
        form.postContent.focus();
        form.send.disabled = false;
        return false;
    }

    myurl="../inc/class.asp?action=addComment&postEmail="+postEmail+"&postContent="+postContent;
    retCode=openUrl(myurl);
    //document.getElementById("button_addComment").value="please wait...";
    switch(retCode){
    case "-2":
        alert('error');
        break;
    case "1":
        alert('ok');
        window.location.reload();
        break;
    case "0":
        alert('no ok');
    }
    return;
}

function openUrl(url){
    var objxml=new ActiveXObject("Microsoft.XMLHttp");
    objxml.open("GET",url,false);
    objxml.send();
    retInfo=objxml.responseText;
    if (objxml.status=="200"){
        return retInfo;
    }
    else{
        return "-2";
   }
}
var szs = new Array( '10px','11px','12px','13px','14px','15px','16px','17px','18px','19px','20px' );
var startSz = 2;
function addSize()
{
	if(++startSz>10) startSz =10;
	document.getElementById("formsizecontrol").style.fontSize = szs[startSz];
}
function minSize()
{
	if(--startSz<0) startSz = 0;
	document.getElementById("formsizecontrol").style.fontSize = szs[startSz];
}
function defSize()
{
	startSz = 2;
	document.getElementById("formsizecontrol").style.fontSize = szs[startSz];
}
////////////////window//////////
$(function(){
	ShowDiv()
})
function closeDiv()
{
    $("#eMeng").animate({
        width:"0px",height:"0px"
    },1000);
	setInterval(function(){$("#eMeng").remove()},1000);
}
function ShowDiv()
{
	$("#eMeng").animate({
	   width:"300px",height:"280px"
	},1000);
	var vertical = setInterval(function(){
		$("#eMeng").css("bottom",document.documentElement.scrollTop-document.documentElement.scrollTop*2+"px");
	},200);
}
