function submit_questions(){
    hidden_question_div();
    ajaxget("eryiju/submit.php?xx=yy", "", "ajaxwaitid", "", "", "window.location.href='space.php';");
}
function submit_form(){
    var form = $('eryiju_home_form');
    var data = "";
    // alert(form);
    if (form){
        form.submit();
        ajaxget(form.action, 'eryiju_question_layer','ajaxwaitid');
        /*
           var inputs = form.getElementsByTagName("input");
           for (var i = 0; i < inputs.length; i++){
           var input = inputs[i];
           if (input.type == "radio" || input.type == "checkbox"){
           if (input.checked)
           data += (input.name ? input.name : input.type) + "=" + encodeURI(input.value) + "&";
           } else
           data += (input.name ? input.name : input.type) + "=" + encodeURI(input.value) + "&";
           }
        // text area
        for (var j = 1; ; j++){
        var ta = document.getElementById('q_t_' + j);
        if (!ta)
        break;
        data += textarea.name + "=" + encodeURI(textarea.value) + "&";
        }*/
        /*
           var textareas = form.getElementsByTagName("textarea");
           for (var i = 0; i < textareas.length; i++){
           var textarea = textareas[i];
           data += textarea.name + "=" + encodeURI(textarea.value) + "&";
           }*/
        // ajaxget('eryiju/show.php?go=next&' + data, 'eryiju_question_layer');
    }
}

function hidden_question_div(){
    var bg = $('eryiju_question_bg');
    var qbox = $('eryiju_question_layer');
    if (bg)
        bg.style.display = 'none';
    if (qbox)
        qbox.style.display = 'none';
}
function add_question_li(){
    var eryiju_ul = $('eryiju_ul');
    if (!eryiju_ul)
        return;
    var ques_li = $('eryiju_ques_li');
    if (!ques_li){
        ques_li = document.createElement('li');
        ques_li.id = "eryiju_ques_li";
        eryiju_ul.appendChild(ques_li);
        var html = "我的问题：<a href='#start' onclick='show_question();return false;'>开始答题</a>&nbsp;&nbsp;<a href='#view'  onclick='show_question(1);return false;'>查看答案</a>";
        ques_li.innerHTML = html;
    }
}
function show_question(view) {
    if(!$('eryiju_question_bg')) {
        div = document.createElement('div'); div.id = 'eryiju_question_bg';
        div.style.position = 'absolute';
        div.style.left = div.style.top = '0px';
        div.style.zIndex = '998';
        div.style.width = '100%';
        div.style.height = document.body.scrollHeight + 'px';
        div.style.backgroundColor = '#000';
        //div.style.display = '';
        div.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=80,finishOpacity=100,style=0)';
        div.style.opacity = 0.9;
        $('append_parent').appendChild(div);
    }

    if(!$('eryiju_question_layer')) {
        div = document.createElement('div');
        div.id = 'eryiju_question_layer';
        //div.style.position = 'absolute';
        var arrayPageSize = getPageSize();
        var arrayPageScroll = getPageScroll();
        var to_left = parseInt((arrayPageSize[0] - 40 - 856) / 2);
        var to_top = parseInt(arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 680) / 2));
        /* div.style.left = ( (to_left>20?to_left:20) + 'px');
           div.style.top  = ( (to_top>30?to_top:30) + 'px');
           div.style.zIndex = '999';
           div.style.display = "none";
           div.style.backgroundColor = '#fff';*/
        //     div.style.display = '';
        $('append_parent').appendChild(div);     
    }
    if (view)
        ajaxget('eryiju/show_question.php?a=b','eryiju_question_layer','ajaxwaitid','','',"$('eryiju_question_bg').style.display='';$('eryiju_question_layer').style.display='';");
    else
        ajaxget('eryiju/start.php?a=b','eryiju_question_layer','','','',"$('eryiju_question_bg').style.display='';$('eryiju_question_layer').style.display='';");
    //  if(is_ie) {
    //      doane(event);
    //}
}//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){

    var xScroll, yScroll;

    if (window.innerHeight && window.scrollMaxY) {	
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }

    var windowWidth, windowHeight;
    if (self.innerHeight) {	// all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }	

    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
        pageHeight = windowHeight;
    } else { 
        pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if(xScroll < windowWidth){	
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }


    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
        return arrayPageSize;
}

//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

    var yScroll;

    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
    }

    arrayPageScroll = new Array('',yScroll) 
        return arrayPageScroll;
}



