var sessionid = 'd148a375838da69e7057a798646b3c19'; // initialise plugins jQuery(function(){ init_boxy(); }); function init_boxy() { var obj = document.createElement("div"); obj.setAttribute('id','boxy'); var objBody = document.getElementsByTagName("body").item(0); objBody.insertBefore(obj, objBody.firstChild); var randomnumber=Math.floor(Math.random()*11235); $('#boxy').load('ajax/boxy.html?rqz='+ randomnumber); } 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; } 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; } function show_box_quotation() { if ( !document.getElementById('box_quotation') ) { init_boxy(); } var arrayPageSize = getPageSize(); var arrayPageScroll = getPageScroll(); var objBox = document.getElementById('box_quotation'); objBox.style.zIndex = '100'; var sirka = 400; objBox.style.width = sirka + "px"; objBox.style.top = "300px"; //var objBoxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objBox.style.height) / 2); var objBoxLeft = ((arrayPageSize[0] - 20 - sirka) / 2); objBox.style.left = objBoxLeft + "px"; //objBox.style.display = 'block'; objBox.style.position = 'absolute'; /* Priesvitne pozadie */ var objBody = document.getElementsByTagName("body").item(0); //var objOverlay = document.createElement("div"); var objOverlay = document.getElementById("overlay"); //objOverlay.setAttribute('id','overlay'); objOverlay.style.height = (arrayPageSize[1] + 'px'); objOverlay.style.display = 'block'; objOverlay.style.position = 'absolute'; objOverlay.style.top = '0'; objOverlay.style.left = '0'; objOverlay.style.zIndex = '90'; objOverlay.style.width = '100%'; objBody.insertBefore(objOverlay, objBody.firstChild); $('#box_quotation').fadeIn('slow'); } function close_box_quotation() { var objOverlay = document.getElementById('overlay'); objOverlay.style.display = 'none'; $('#box_quotation').fadeOut('slow'); } function show_box_status() { if ( !document.getElementById('box_status') ) { init_boxy(); } var arrayPageSize = getPageSize(); var arrayPageScroll = getPageScroll(); var objBox = document.getElementById('box_status'); objBox.style.zIndex = '100'; var sirka = 650; objBox.style.width = sirka + "px"; objBox.style.top = "50px"; //var objBoxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objBox.style.height) / 2); var objBoxLeft = ((arrayPageSize[0] - 20 - sirka) / 2); objBox.style.left = objBoxLeft + "px"; //objBox.style.display = 'block'; objBox.style.position = 'absolute'; /* Priesvitne pozadie */ var objBody = document.getElementsByTagName("body").item(0); //var objOverlay = document.createElement("div"); var objOverlay = document.getElementById("overlay"); //objOverlay.setAttribute('id','overlay'); objOverlay.style.height = (arrayPageSize[1] + 'px'); objOverlay.style.display = 'block'; objOverlay.style.position = 'absolute'; objOverlay.style.top = '0'; objOverlay.style.left = '0'; objOverlay.style.zIndex = '90'; objOverlay.style.width = '100%'; objBody.insertBefore(objOverlay, objBody.firstChild); document.getElementById('evidencne_cislo').value = ""; $("#status_info_loading").hide() $("#status_info_ec").show() $('#status_info').html(""); $('#box_status').fadeIn('slow'); } function close_box_status() { var objOverlay = document.getElementById('overlay'); objOverlay.style.display = 'none'; $('#box_status').fadeOut('slow'); } function close_box() { close_box_quotation(); close_box_status(); } function SendQuotation() { var valid = true; var xhr = Math.floor(Math.random()*12345); //var typ_zariadenia = encodeURI(document.getElementById('q_typ_zariadenia').value); var typ_zariadenia = (document.getElementById('q_typ_zariadenia').value); //var model = encodeURI(document.getElementById('q_model').value); var model = (document.getElementById('q_model').value); //var popis = encodeURI(document.getElementById('q_popis').value); var popis = (document.getElementById('q_popis').value); var tel = (document.getElementById('q_tel').value); var email = (document.getElementById('q_email').value); if ( typ_zariadenia == '' ) {valid = false; } if ( model == '' ) {valid = false; } if ( popis == '' ) {valid = false; } if ( tel == '' ) {valid = false; } if ( email == '' ) {valid = false; } if ( valid ) { $.get("/ajax/SendQuotation.php", { skhr : sessionid , xhr: xhr, typ_zariadenia: typ_zariadenia, model: model, popis: popis, tel: tel, email: email } ); show_box_quotation(); document.getElementById('q_typ_zariadenia').value = ""; document.getElementById('q_model').value = ""; document.getElementById('q_popis').value = ""; document.getElementById('q_tel').value = ""; document.getElementById('q_email').value = ""; } else { alert("Prosím, vyplňte korektne všetky povinné položky.") } } function GetStatus() { var xhr = Math.floor(Math.random()*12345); var zakazka_id = encodeURI(document.getElementById('evidencne_cislo').value); $("#status_info_ec").hide() $("#status_info_loading").show(); $.get("/ajax/GetStatus.php", {skhr : sessionid , xhr : xhr, zakazka_id: zakazka_id} , function(data) { $("#status_info_loading").hide(); $('#status_info').html(data); }); } function CheckEmail(email) { var firstchunk,indx,secondchunk if (email == ""){ return false } //get the zero-based index of the "@" character indx = email.indexOf("@") //if the string does not contain an @ then then return true if (indx == -1 ){ return false } //if the first part of email is < 2 chars and second part < 7 chars //(arbitrary but workable criteria) then reject the input address firstchunk = email.substr(0,indx) //up to but not including the "@" //start at char following the "@" and include up to end of email addr secondchunk = email.substr(indx + 1) //if the part following the "@" does not include a period "." then //also return false if ((firstchunk.length < 2 ) || (secondchunk.length < 7) || (secondchunk.indexOf(".") == -1)){ return false } //the email was okay; at least it had a @, more than 1 username chars, //more than 6 chars after the "@", and the substring after the "@" // contained a "." char return true } function milanko() { var rozmeri = getPageSize(); var vyska_page = rozmeri[0]; var sirka_page = rozmeri[1]; var vyska_obrazovky = rozmeri[3]; var sirka_obrazovky = rozmeri[2]; var scroll_x = window.pageXOffset; var scroll_y = window.pageYOffset; if (scroll_x == undefined) scroll_x = document.documentElement.scrollLeft; if (scroll_y == undefined) scroll_y = document.documentElement.scrollTop; var p_left = sirka_obrazovky + scroll_x - 350; var p_top = vyska_obrazovky + scroll_y - 240; document.getElementById('milanko').style.left = p_left + "px"; document.getElementById('milanko').style.top = p_top + "px"; }