// getElementById egyszerűsítve function $div(id) { return document.getElementById(id); } // láthatóvá tesz egy divet function showDiv(_id) { $div(_id).style.display = 'block'; } // elrejt egy divet function hideDiv(_id) { $div(_id).style.display = 'none'; } if (navigator.appName.indexOf("Internet Explorer") > -1) { isIE = true; } else { isIE = false; } /******************************************************************/ /** CHANGE OPACITY -- IE MIATT KELL KÜLÖN **/ function opacity(id, opacStart, opacEnd, millisec) { //speed for each frame var speed = Math.round(millisec / 100); var timer = 0; //determine the direction for the blending, if start and end are the same nothing happens if(opacStart > opacEnd) { for(i = opacStart; i >= opacEnd; i--) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } else if(opacStart < opacEnd) { for(i = opacStart; i <= opacEnd; i++) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } } function changeOpac(opacity, id) { $div(id).filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity; } function checkmaxlength(textareaobj, maxlength) { if(textareaobj.value.length>=maxlength) { textareaobj.value = textareaobj.value.substring(0, maxlength); textareaobj.focus(); } else { } } function getObject( obj ) { if ( document.getElementById ) { obj = document.getElementById( obj ); } else if ( document.all ) { obj = document.all.item( obj ); } else { obj = null; } return obj; } function getPosition(e) { e = e || window.event; var cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY; } else { var de = document.documentElement; var b = document.body; cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0); cursor.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0); } return cursor; } function getScreenWidth() { if (self.innerWidth) { return self.innerWidth; } if (document.documentElement && document.documentElement.clientWidth) { return document.documentElement.clientWidth; } if (document.body) { return document.body.clientWidth; // return document.body.innerWidth; } } function getScreenHeight() { if (self.innerHeight) { // alert ("self.innerHeight"); return self.innerHeight; } if (document.documentElement && document.documentElement.clientHeight) { // alert ("document.documentElement.clientHeight"); return document.documentElement.clientHeight; } if (document.body) { // alert ("document.body.clientHeight"); return document.body.clientHeight; } } function getScrollWidth() { var w = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft; return w ? w : 0; } function getScrollHeight() { var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop; return h ? h : 0; } function moveObject( obj, e , imgWidth, imgHeight) { var tempX = 0; var tempY = 0; var offset = 0; var objHolder = obj; obj = getObject( obj ); if (obj==null) return; /* if (document.all) { tempX = event.clientX + document.body.scrollLeft; tempY = event.clientY + document.body.scrollTop; } else { tempX = e.pageX; tempY = e.pageY; } if (tempX < 0){tempX = 0} if (tempY < 0){tempY = 0} */ cursorpos = getPosition(e); // obj.style.top = (cursorpos.y - 30 + offset) + 'px'; // obj.style.left = (cursorpos.x - 140 - Math.round((getScreenWidth()-980)/2) + offset) + 'px'; // obj.style.left = (cursorpos.x + 30 - Math.round((getScreenWidth()-900)/2) + offset) + 'px'; /* obj.style.top = (cursorpos.y + 10 + offset) + 'px'; if (cursorpos.x + 640>getScreenWidth()) obj.style.left = (getScreenWidth()-640) + 'px'; else obj.style.left = (cursorpos.x + 10 + offset) + 'px'; */ if (cursorpos.x + imgWidth > getScreenWidth()) obj.style.left = ((getScreenWidth()-imgWidth)-(getScreenWidth()-cursorpos.x) -10) + 'px'; else obj.style.left = (cursorpos.x + 10 + offset) + 'px'; if (cursorpos.y + getScrollHeight() + imgHeight > getScreenHeight()+getScrollHeight()) obj.style.top = (getScreenHeight()-imgHeight+getScrollHeight()) + 'px'; else obj.style.top = (cursorpos.y + 10 + offset + getScrollHeight()) + 'px'; // window.status="cursorX: "+cursorpos.x+" cursorY: "+cursorpos.y+" | screenX: "+getScreenWidth()+" screenY: "+getScreenHeight()+" | scrollX: "+getScrollWidth()+" scrollY: "+getScrollHeight()+" | imgW: "+imgWidth+" imgH: "+imgHeight+" | posX: "+obj.style.left+" posY: "+obj.style.top; // obj.style.top = (cursorpos.y - Math.round((getScreenHeight()-imgHeight)/2) + offset) + 'px'; // obj.style.left = (cursorpos.x - Math.round((getScreenWidth()-imgWidth)/2) + offset) + 'px'; // obj.style.top = (Math.round((getScreenHeight()/2-imgHeight)/2) + offset) + 'px'; // obj.style.left = (Math.round((getScreenWidth()/2-imgWidth)/2) + offset) + 'px'; displayObject( objHolder, true ); } function displayObject( obj, show) { obj = getObject( obj ); if (obj==null) return; obj.style.display = show ? 'block' : 'none'; obj.style.visibility = show ? 'visible' : 'hidden'; } function DivPrint(strid) { var prtContent = document.getElementById(strid); var winWidth=500; var winHeight=300; var WinPrint = window.open('','','left='+(getScreenWidth()-winWidth)/2+',top='+(getScreenHeight()-winHeight)/2+',width='+winWidth+',height='+winHeight+',toolbar=0,scrollbars=0,status=0'); WinPrint.document.write(''); /* FF miatt kell, egyébként stílus nélkül jön fel */ WinPrint.document.write(prtContent.innerHTML); WinPrint.document.close(); WinPrint.focus(); WinPrint.print(); WinPrint.close(); prtContent.innerHTML=strOldOne; }