var selectId ;
function writeFlashObj()
{
var swf_width='247';
var swf_height='213';
var files='/upload/M1236317997454.JPG|/upload/M1236317997453.JPG|/upload/M1211282038474.JPG|/upload/M1222244296699.jpg|/upload/M1211282038457.gif|/upload/M1211282038456.gif|/upload/M1211282038445.jpg|/upload/M1211282038444.jpg|/upload/M1217649435149.jpg';
var links='/upload/M1236317997454.JPG|http://www.comejp.com/bbs/dispbbs.asp?boardid=13&Id=58|/info/bb1799661a957f9a011acd2ea0570068.html|http://www.comejp.com/bbs/dispbbs.asp?boardid=11&id=65&page=1&star=1|/info/bb179966196cd4b6011973d49c280048.html|/info/bb179966198114e90119cd8a44f20023.html|/info/bb179966196cd4b601196ef6eea20004.html|/info/bb179966196cd4b601196ef073700003.html|http://www.comejp.com/bbs';
var texts='2009重庆教育展|国际班08元旦晚会|日语初级入门班|机场送行赴日研究生|法国硕士工程师项目|日本国、公立研究生项目|法国国立大学预科直通车|日本特色大学预科|新西兰讲座现场拍摄';
document.write('');
}
function writeHeaderFlash()
{
document.write('');
}
function doSearch()
{
if(document.getElementById("keyword").value != '')
{
document.getElementById("cmd").value="search";
document.getElementById("searchForm").action="/searchQuestion.do";
document.getElementById("searchForm").submit();
}
else
{
alert('请在输入框中输入您想搜索的问题');
}
}
function doCreate(targetInputId)
{
openNewDiv('popup_upload_div',targetInputId,300,100);
var url = '/index/questionDiv.jsp';
var pars = 's='+Math.random();
var myAjax = new Ajax.Updater('popup_upload_div', url, {method: 'get', parameters: pars});
}
function doSubmitCreate()
{
if(document.getElementById("question").value == '')
{
alert('必须输入您想咨询的问题');
return ;
}
if(document.getElementById("numberOnpicture").value == '')
{
alert('必须输入验证码');
return ;
}
checkSessionCode();
}
function checkSessionCode()
{
var url = "/index/sessionCode.jsp";
var pars = "s="+Math.random();
var myAjax = new Ajax.Request(url,{method: 'get', parameters: pars, onComplete: showUserLoginStatus});
}
function showUserLoginStatus(originalRequest)
{
var str = originalRequest.responseText;
if(str == document.getElementById("numberOnpicture").value)
{
alert('您的问题已经提交,我们会尽快做出答复!');
document.getElementById("questionDivForm").submit();
}
else
{
alert('验证码输入错误!');
}
}
function getOffSet(obj)
{
var top = obj.offsetTop;
var left = obj.offsetLeft;
while (obj = obj.offsetParent)
{
top += obj.offsetTop;
left += obj.offsetLeft;
}
var rec = new Array(1);
rec[0] = top;
rec[1] = left;
return rec
}
function openNewDiv(openDivId,targetId,width,height)
{
var m = "mask";
if (document.getElementById(openDivId)) document.removeChild(docEle(openDivId));
if (document.getElementById(m)) document.removeChild(document.getElementById(m));
var newDiv = document.createElement("div");
newDiv.id = openDivId;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "9999";
var obj = document.getElementById(targetId);
var pos = getOffSet(obj);
newDiv.style.left = pos[1]+'px';
newDiv.style.top = (pos[0]+obj.offsetHeight+4)+'px';
newDiv.style.width = width + "px";
newDiv.style.height = height + "px";
newDiv.style.background = "#EFEFEF";
newDiv.style.border = "1px solid #860001";
newDiv.style.padding = "5px";
newDiv.innerHTML = "";
document.body.appendChild(newDiv);
// mask图层
var newMask = document.createElement("div");
newMask.id = m;
newMask.style.position = "absolute";
newMask.style.zIndex = "1";
newMask.style.width = document.body.scrollWidth + "px";
newMask.style.height = document.body.scrollHeight + "px";
newMask.style.top = "0px";
newMask.style.left = "0px";
newMask.style.background = "#000";
newMask.style.filter = "alpha(opacity=40)";
newMask.style.opacity = "0.40";
document.body.appendChild(newMask);
}
function closeNewDiv(openDivId,maskId)
{
document.body.removeChild(document.getElementById(openDivId));
document.body.removeChild(document.getElementById(maskId));
}
function show(link,id)
{
if(selectId)
hide();
document.onclick=null;
var obj = document.getElementById('category_'+id);
if(obj)
{
if(obj.style.display=="")
{
obj.style.display="none";
setTimeout("attachEvent(false)", 1);
}
else
{
obj.style.display="";
setTimeout("attachEvent(true)", 1);
}
var pos = getObjOffSet(link);
obj.style.cssText = 'position:absolute;margin-left:8px;margin-right:8px;left:' + (pos[1]-10)+ 'px;top:' + (pos[0] + link.clientHeight + 27) + 'px;border:solid 2px;z-index:1000';
}
selectId = id;
}
function attachEvent(attach)
{
if(attach)
document.onclick=hide;
else
document.onclick=null;
}
function hide()
{
var obj = document.getElementById('category_'+selectId);
if(obj)obj.style.display="none";
}