/*
lovewall.js 2007-11-15
by terry
for support the lovewall comment
*/
//----------------------------------------begin-----the pop-out message-window--------------------------------
var isIe=(document.all)?true:false;
//get the position of your click(mouse)
function mousePosition(ev)
{
if(ev.pageX || ev.pageY)
{
return {x:ev.pageX, y:ev.pageY};
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
}
//pop-out the message window
function showMessageBox(wTitle,content,pos,wWidth)
{
closeWindow();
var bWidth=parseInt(document.documentElement.scrollWidth);
var bHeight=parseInt(document.documentElement.scrollHeight);
var back=document.createElement("div");
back.id="back";
var styleStr="top:0px;left:0px;position:absolute;background:#000000;width:"+bWidth+"px;height:"+bHeight+"px;z-index:999999;"; //the background div style
styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;"; //compatible with both IE and FireFox
back.style.cssText=styleStr;
document.body.appendChild(back);
showBackground(back,60); //the second parameter is set to max value to back
var mesW=document.createElement("div");
mesW.id="mesWindow";
mesW.className="mesWindow";
mesW.innerHTML="
"+wTitle+"
"+content+"
";
styleStr="left:320px;top:450px;position:absolute;width:"+wWidth+"px;";
mesW.style.cssText=styleStr; //the above code set the attribute of message-window
document.body.appendChild(mesW);
}
//let the background be back bit by bit
function showBackground(obj,endInt)
{
if(isIe)
{
obj.filters.alpha.opacity+=4;
if(obj.filters.alpha.opacity
Your Name:
";
showMessageBox('The Longest Way Lovewall Comments',messContent,objPos,620);
}
//----------------------------------------end-------window------------------------------>
//----------------------------------begin---comment drag-mini-window-------------------->
//-------delete the drag-mini-window-->
function ssdel(ev){
ev = ev||window.event;
var lObj = ev.target||ev.srcElement;
while (lObj && lObj.tagName != "DIV") lObj = lObj.parentNode ;
var id=lObj.id
var elem = document.getElementById(id);
if(elem!=null)
elem.parentNode.removeChild(elem);
}
//-- the move of drag-mini-window -->
var Obj=''
var elem=''
var top
var left
var index=10000;//z-index;
document.onmouseup=MUp
document.onmousemove=MMove
//when you click down the left key of mouse and not release, this function record the intial position
function MDown(ev,Objt){
ev = ev||window.event;
var lObj = ev.target||ev.srcElement;
while (lObj && lObj.tagName != "DIV") lObj = lObj.parentNode ;
Obj=lObj.id;
elem = document.getElementById(Obj);
if(elem.setCapture)
elem.setCapture(true);
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE);
elem.style.top = (elem.style.top)?elem.style.top : 0;
elem.style.left = (elem.style.left)?elem.style.left : 0;
elem.style.position = "absolute";
top = parseInt(elem.style.top) - ev.clientY;
left = parseInt(elem.style.left) - ev.clientX;
}
//when you drag the window, this function track the mouse-position
function MMove(ev){
ev = ev||window.event;
if(Obj!=''){
elem.style.top = ev.clientY + top + "px";
elem.style.left = ev.clientX + left + "px";
}
}
//when the mouse released,make releaseCapture operation
function MUp(){
if(elem!=''){
if(elem.releaseCapture)
elem.releaseCapture();
Obj='';
}
}
//------get the focus----------------
function getFocus(obj)
{
if(obj.style.zIndex!=index)
{
index = index + 2;
var idx = index;
obj.style.zIndex=idx;
}
}
var ie = false;
function getObj(id) {
if (ie) { return document.all[id]; }
else { return document.getElementById(id); }
}
//set the tagcolour
function setColor(color) {
getObj('ccsample').style.background = '' + color;
if(typeof(cf)=='undefined')
document.cf.elements.tagbcolor.value = color ;
else
cf.tagbcolor.value = color;
}
//cout the number of character you input
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
//if the number of character in textarea is greater than max-num, just get max-num
field.value = field.value.substring(0, maxlimit);
else
//show the number of left character in the field
countfield.value = maxlimit - field.value.length;
document.getElementById('contentsample').innerHTML = field.value;
}
//check the textfield and name which can't be blank
function chkform() {
if(typeof(cf)=='undefined')
cf=document.cf.elements;
if (cf.massages.value == "")
{alert("...i can't read the blank");
cf.massages.focus();
return false; }
if (cf.author.value == "")
{alert("\Please leave your name thanks~");
cf.author.focus();
return false;
}
return true;
}