// DehaOnline Main JS // code by levonix var congAlerts = new Array(); var emQs = new Array(); var finisher, examTime; var kitapUyari = "Kitaplarımızın basımı tükenmiştir.\nYeni basılacak kitaplar 20.05.2010'da çıkacaktır."; function valueCleaner(obj) { if(obj.type == 'text') { if(!obj.getAttribute('firstValue')) { obj.setAttribute('firstValue', obj.value); obj.value = ''; } else if(obj.value != '' && obj.value != obj.getAttribute('firstValue')) obj.value = obj.value; else if(obj.value == obj.getAttribute('firstValue')) obj.value = ''; else obj.value = obj.getAttribute('firstValue'); } } function siteSearch() { var sword = document.getElementById('searchBox').value; if(sword.length > 0) { location.href = "index.php?a=searchResult&q=" + sword; } } function addToBasket(productId, warning) { if(warning == 1) { alert(kitapUyari); } else { $('productids').value = productId; $('basketform').submit(); } } function removeItems(productId) { $('deleteItem').value = productId; $('deleteItems').submit(); } function getInternetExplorerVersion() { var rv = -1; // Return value assumes failure. if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 ); } return rv; } function getWinSize(w) { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } if(w == 'w') return myWidth; else if(w == 'h') return myHeight; } function checkVersion() { var msg = "You're not using Internet Explorer."; var ver = getInternetExplorerVersion(); if ( ver > -1 ) { if ( ver >= 8.0 ) msg = "You're using a recent copy of Internet Explorer."; else msg = "You should upgrade your copy of Internet Explorer."; } alert( msg ); } function getPageSizeWithScroll() { if (window.innerHeight && window.scrollMaxY) {// Firefox yWithScroll = window.innerHeight + window.scrollMaxY; xWithScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac yWithScroll = document.body.scrollHeight; xWithScroll = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari yWithScroll = document.body.offsetHeight; xWithScroll = document.body.offsetWidth; } arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll); //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll ); return arrayPageSizeWithScroll; } function scrollX() {return window.pageXOffset ? window.pageXOffset : document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft;} function scrollY() {return window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;} function mainIntro() { $('lbOverlay').style.display = 'none'; $('lbCenter').style.display = 'none'; $('mainflash').style.visibility = 'visible'; $('mainflash2').style.visibility = 'visible'; document.body.style.overflow = 'auto'; $('html').style.overflowY = 'auto'; $('html').style.overflowX = 'hidden'; } function ovw(url, sign) { var vtop = 0; if(getInternetExplorerVersion() == '6') { vtop = parseInt(document.documentElement.scrollTop); } else if(getInternetExplorerVersion() == '7') { vtop = scrollY(); } else { vtop = scrollY(); } $('tobi').style.display = (sign == '1') ? 'inline' : 'none'; $('mainflash').style.visibility = (sign == '1') ? 'hidden' : 'visible'; $('pein').style.display = (sign == '1') ? 'inline' : 'none'; var topSpace = 0; //var topSpace = ((parseInt($('peinTable').offsetHeight) - 450)/2) + (getWinSize('h')-428)/2; if(sign == '1') { $('peinTable').style.marginTop = (vtop + topSpace) + 'px'; } //alert(getPageSizeWithScroll()[1]); if(url) { $('lecture').src = url; } document.body.style.overflow = (sign == '1') ? 'hidden' : 'auto'; $('html').style.overflowY = (sign == '1') ? 'hidden' : 'auto'; $('html').style.overflowX = 'hidden'; } function qClick(obj, slc, qCount, sign) { if(sign == 1) { var radioBox = document.getElementById(qCount + "_" + slc); if(slc == emQs[qCount - 1]) { document.getElementById("qRow" + qCount + emQs[qCount - 1]).className = 'hrow3'; emQs.remove(emQs[qCount - 1]); radioBox.checked = false; } else { if(emQs[qCount - 1]) { document.getElementById("qRow" + qCount + emQs[qCount - 1]).className = ''; } emQs[qCount - 1] = slc; radioBox.checked = true; obj.className = 'hrow4'; } } } function qHover(obj, sign) { if(sign == 1 && obj.className != 'hrow4') obj.className = 'hrow3'; else if(sign == 0 && obj.className != 'hrow4') obj.className = ''; } function rowHover(obj) { obj.className = (obj.className == 'hrow42') ? '' : 'hrow42'; } function sh0wh1de(objId) { var obj = document.getElementById(objId); //obj.style.display = (sign == 1) ? "inline" : "none"; if(obj.getAttribute("show") == "0") { obj.style.display = "inline"; obj.setAttribute("show", "1"); //alert(obj.getAttribute('show')); } else { obj.style.display = "none"; obj.setAttribute("show", "0"); } } function sh0werh1der(objShow, objHide, objHide2) { $(objShow).style.display = "inline"; $(objHide).style.display = "none"; $(objHide2).style.display = "none"; } function listShowHide(objId) { var obj = document.getElementById('ico_arrow_' + objId); var top10_link = document.getElementById('top10_link_' + objId); if(obj.getAttribute("show") == "0") { obj.src = "img/ico_up.gif"; top10_link.innerHTML = "Deneme Sınavı " + objId + " - İlk 10 Listesini Gizle"; obj.setAttribute("show", "1"); //alert(obj.getAttribute('show')); } else { obj.src = "img/ico_down.gif"; top10_link.innerHTML = "Deneme Sınavı " + objId + " - İlk 10 Listesini Göster"; obj.setAttribute("show", "0"); } } function listShowHide2(objId) { var obj = document.getElementById('ico2_arrow_' + objId); var anlys_link = document.getElementById('anlys_link_' + objId); if(obj.getAttribute("show") == "0") { obj.src = "img/ico_up.gif"; anlys_link.innerHTML = "Deneme Sınavı " + objId + " - Ders Analizini Gizle"; obj.setAttribute("show", "1"); //alert(obj.getAttribute('show')); } else { obj.src = "img/ico_down.gif"; anlys_link.innerHTML = "Deneme Sınavı " + objId + " - Ders Analizini Göster"; obj.setAttribute("show", "0"); } } function changeLocation(menuObj, page) { var i = menuObj.selectedIndex; window.location = "index.php?a=" + page + "&ag=" + menuObj.options[i].value; } function changeLocation2(menuObj, page, param, param2) { var i = menuObj.selectedIndex; window.location = "index.php?a=" + page + "&ag=" + param2 + "&" + param + "=" + menuObj.options[i].value; } function changeLocation3(menuObj, page, p1, p2) { window.location = "index.php?a=" + page + "&" + p1 + "=" + p2 + "&ex=" + menuObj.options[menuObj.selectedIndex].value; } function imgHover(obj, imgType) { obj.src = (obj.src.indexOf('_h.'+imgType) == -1) ? obj.src.replace(/\.gif/g, "_h."+imgType) : obj.src.replace(/\_h.gif/g, ".gif"); } function pngHover(obj, imgType) { obj.src = (obj.src.indexOf('_t.'+imgType) == -1) ? obj.src.replace(/\.png/g, "_t."+imgType) : obj.src.replace(/\_t.png/g, ".png"); } function nav(obj,sign) { obj.className = (sign == 1) ? 'navPart_h' : 'navPart'; } function rowBg(obj,sign) { obj.className = (sign == 1) ? 'rowNews' : ''; } function trBg(obj,sign) { obj.className = (sign == 1) ? 'trBg' : ''; } function levo(obj,sign) { obj.src = (sign == 1) ? 'img/levonix_h.gif' : 'img/levonix.gif'; } function selecter(obj) { location.href = obj.value; } function publishDocOpener(objId) { var openImg = "wop.php?id=" + objId; window.open (openImg, "Deha","location=0,status=0,scrollbars=0,width=530,height=700"); } /* window.onload = function(e) { if(Math.random()*2 >= 1) alert('unblock'); else alert('block'); } window.onload = function() { window.open ("deha_mkoy.html", "Deha","location=0,status=0,scrollbars=0,width=416,height=600"); } */ var stime; var bgpos = 0; function animateLine() { $('mainline').style.backgroundPosition = (bgpos + "%"); bgpos = bgpos + 5; stime = setTimeout("animateLine()", 80); } function stopLine() { cleartTimeout(stime); } window.onload = function() { if($('mainline')) { //animateLine(); } if($('focusme')) $('focusme').focus(); } function pswRepeat(obj1, obj2) { if(obj1.value != '') { if(obj1.value == obj2.value) return true; else { alert(obj2.getAttribute("message")); obj2.focus(); return false; } } else { alert(obj1.getAttribute("message")); obj1.focus(); return false; } } function getter(objId, sign) { var adim = document.getElementById('adim' + objId); adim.style.display = (sign == 1) ? "inline" : "none"; } function mdopener(which, maxnum, sign) { var n; for(n=1; n <= maxnum; n++) { if(which != n) { document.getElementById('madde' + n).className = 'hidden'; } else { document.getElementById('madde' + n).className = 'visible'; } } } function focuser(obj) { if(obj.type == 'text') { if(!obj.getAttribute('firstValue')) { obj.setAttribute('firstValue', obj.value); obj.value = ''; } else if(obj.value != '' && obj.value != obj.getAttribute('firstValue')) obj.value = obj.value; else if(obj.value == obj.getAttribute('firstValue')) obj.value = ''; else obj.value = obj.getAttribute('firstValue'); } else if(obj.type == 'password') { if(!obj.value) { obj.className = (obj.className == 'pswdBox') ? obj.className = 'pswdBox2' : obj.className = 'pswdBox'; // I can't change type of input with 'setAttribute' because of that goddamn IE bug! } } } function ku$kana() { alert('ku$kana yalcin...'); } function finishim() // fight, finish him! { finisher = 1; //xhr('','joker.php?finish=1'); xhr('dynamicContent','e-learning.php?cmd=result&cq=1&exmout=1&ft=' + finishTime); //$('countdowncontainer').innerHTML = "K.O."; //alert("K.O."); } function playPause(command) { var play = document.getElementById('b-play'); var pause = document.getElementById('b-pause'); var pp = document.getElementById('btn-pp'); if(command == "play") { play.className = "hidden"; pause.className = "show"; } else if(command == "pause") { pause.className = "hidden"; play.className = "show"; } /* if(command == "play") pp.innerHTML = ""; else if(command == "pause") pp.innerHTML = ""; */ } function fullscreen(url) { window.open(url, '', 'fullscreen=yes, scrollbars=0, status=0, toolbar=0, location=0'); } function ajxQuestion(obj, slc, qCount, qId, sign) { if(sign == 1) { //alert(examTime); qhr(obj.id, 'e-learning.php?cmd=result&et=' + examTime + '&qId=' + qId + '&qck=1' + '&qsel=' + slc + '&qNum=' + qCount, slc, qCount); } /* else if(sign == 2) { //alert("sign = " + sign); alert(slc); var radioBox = document.getElementById(qCount + "_" + slc); if(slc == emQs[qCount - 1]) { document.getElementById("qRow" + qCount + emQs[qCount - 1]).className = 'hrow3'; emQs.remove(emQs[qCount - 1]); radioBox.checked = false; } else { if(emQs[qCount - 1]) { document.getElementById("qRow" + qCount + emQs[qCount - 1]).className = ''; } emQs[qCount - 1] = slc; radioBox.checked = true; obj.className = 'hrow4'; } }*/ }