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 showRestaurantInfo(){
	$("#banner").find("div").css("display","none");
	$("#showRestaurantInfo").fadeIn(500);
}
function hiddenRestaurantInfo(){
	$("#banner").find("div").css("display","none");
}
function showBusinessHours(){
	$("#banner").find("div").css("display","none");
	$("#showBusinessHours").fadeIn(500);
}
function hiddenBusinessHours(){
	$("#banner").find("div").css("display","none");
}
function showPaymentoptions(){
	$("#banner").find("div").css("display","none");
	$("#showPaymentoptions").fadeIn(500);
}
function hiddenPaymentoptions(){
	$("#banner").find("div").css("display","none");
}
function showDelivery(){
	$("#banner").find("div").css("display","none");
	$("#showDelivery").fadeIn(500);
}
function hiddenDelivery(){
	$("#banner").find("div").css("display","none");
}
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;
	var postTitle = form.postTitle.value;
	if (postTitle==null||postTitle==''){
        alert("Please type your Title");
        form.postTitle.focus();
        form.send.disabled = false;
        return false;
    }
    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 + "&postTitle=" + postTitle;
    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";
   }
}
