var basehref = "http://motomobile.eu/"; var lang = ""; var imagesdir = "./templates/default/images/"; var template = "default"; var thumbnail = "_sm"; var middlethumbnail = "_th"; function Goto(href) { window.location.href = href; } function Back() { history.back(); } function ShowWindow(address,width,height) { window.open(address, "", "width="+width+", height="+height+", scrollbars, resizable"); } function Preview(guid) { ShowWindow(basehref+"/?m=preview&guid="+guid+lang,800,600); } function PrintOffer(guid) { ShowWindow(basehref+"/?m=print&s=offer&guid="+guid+lang,800,600); } function PrintOffers(pid,order,page) { ShowWindow(basehref+"/?m=print&s=offers&pid="+pid+"&o="+order+"&p="+page+lang,800,600); } function PrintPage() { window.print(); } function Sort(indx) { path = window.location.href; pos = path.indexOf("&o="); if (pos == -1) { path = path + "&o="+indx; } else { path = path.substr(0,pos); path = path + "&o="+indx; } Goto(path); } function GotoPage() { p = document.getElementById('page').value; path = window.location.href; pos = path.indexOf("&p="); if (pos == -1) { path = path + "&p="+p; } else { path = path.substr(0,pos); path = path + "&p="+p; } Goto(path); } function GotoPage2() { p = document.getElementById('page2').value; path = window.location.href; pos = path.indexOf("&p="); if (pos == -1) { path = path + "&p="+p; } else { path = path.substr(0,pos); path = path + "&p="+p; } Goto(path); } function IsValidObject(objToTest) { if (objToTest == null || objToTest == undefined) { return false; } return true; } function SubmitForm(formname) { var form = document.getElementById(formname); if (IsValidObject(form)) { form.submit(); } } function addOption(selectId, txt, val) { var objOption = new Option(txt, val); document.getElementById(selectId).options.add(objOption); } function selOption(selectId,val) { document.getElementById(selectId).selectedIndex = val; } function clearOptions(selectId) { var lb = document.getElementById(selectId); for (var i=lb.options.length-1; i>=0; i--){ lb.options[i] = null; } lb.selectedIndex = -1; } function checkEnter(e){ var characterCode; if(e && e.which){ //if which property of event object is supported (NN4) e = e characterCode = e.which //character code is contained in NN4's which property } else{ e = event characterCode = e.keyCode //character code is contained in IE's keyCode property } if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key) return false } else{ return true } } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function Add2Clipboard(offerid) { if (readCookie('off'+offerid)==null) { createCookie('off'+offerid,offerid,30); return true; } else { return false; } } function Add2Notepad(guid) { if (readCookie('note'+guid)==null) { createCookie('note'+guid,guid,30); return true; } else { return false; } } $(document).ready(function(){ $('a[id="up"]').click(function() { $(window).scrollTo( {top:'0px', left:'0px'}, 800 ); }); $('#home').click(function() { lang = lang.replace("&","?"); window.location.href = "./"+lang; }); $('div[class*="menu-"]').click(function() { module = $(this).attr('id').replace("menu-", ""); pos = module.indexOf('page'); if (pos > -1) { id = module.replace("page-", ""); module = "page&id="+id; } window.location.href = "./?m="+module+lang; }); $('div[class*="rmenu-"]').click(function() { module = $(this).attr('id').replace("rmenu-", ""); window.location.href = "./?m="+module+lang; }); $('input[id="inne_dane_faktura"]').click(function() { enabled = !($(this).is(":checked")); $('input[id="nazwa_firmy"]').attr('disabled',enabled); $('input[id="ulica_firmy"]').attr('disabled',enabled); $('input[id="miejscowosc_firmy"]').attr('disabled',enabled); $('input[id="kod_pocztowy_firmy"]').attr('disabled',enabled); }); $('a[id*="add2clip"]').click(function() { if ($("#secClipInfo").is(":hidden")) { $('span[id="secClipInfoOK"]').hide(); $('span[id="secClipInfoErr"]').hide(); $("#secClipInfo").slideDown("fast"); oid = $(this).attr('id').replace("add2clip_",""); if (readCookie('iscookie')==null) { $('span[id="secClipInfoErrCoo"]').show(); setTimeout( "$('#secClipInfo').slideUp('fast');" , 2000); } else { if (!Add2Clipboard(oid)) { $('span[id="secClipInfoErr"]').show(); } else { $('span[id="secClipInfoOK"]').show(); } setTimeout( "$('#secClipInfo').slideUp('fast');" , 8000); } } }); $('a[id*="add2note"]').click(function() { if ($("#secNoteInfo").is(":hidden")) { $('span[id="secNoteInfoOK"]').hide(); $('span[id="secNoteInfoErr"]').hide(); $("#secNoteInfo").slideDown("fast"); guid = $(this).attr('id').replace("add2note_",""); if (readCookie('iscookie')==null) { $('span[id="secNoteInfoErrCoo"]').show(); setTimeout( "$('#secNoteInfo').slideUp('fast');" , 2000); } else { if (!Add2Notepad(guid)) { $('span[id="secNoteInfoErr"]').show(); } else { $('span[id="secNoteInfoOK"]').show(); } setTimeout( "$('#secNoteInfo').slideUp('fast');" , 8000); } } }); $('a[id*="psh_"]').toggle(function(){ var id = $(this).attr('id').replace("psh_", ""); if ($('#sh_'+id).is(":hidden")) { $('#sh_'+id).slideDown('slow'); } else { $('#sh_'+id).slideUp('slow'); } },function(){ var id = $(this).attr('id').replace("psh_", ""); if ($('#sh_'+id).is(":visible")) { $('#sh_'+id).slideUp('slow'); } else { $('#sh_'+id).slideDown('slow'); } }); $('img[id*="zdj"]').click(function() { photopath = $(this).attr('src').replace("_sm",""); if (photopath.indexOf("noimage.jpg")!=-1) { return false; } else { window.open(photopath, '','menubar=0, toolbar=0, location=0, scrollbars=0, resizable=0, status=0,width=820, height=620'); } }); /*$('div[class*="tab"]').click(function() { type = $(this).attr('id').replace("tab-", ""); currclass = $('td[id="secsmSearchbg"]').attr('class'); if (currclass!="") { $('td[id="secsmSearchbg"]').removeClass(currclass); } else { $('td[id="secsmSearchbg"]').removeClass("td-searchsmcar"); } newclass = "td-searchsm"+type; $('td[id="secsmSearchbg"]').addClass(newclass); xajax_ChangesmForm(type); });*/ }); function PayInfo(guid,text) { if ($("#secPayInfo_"+guid).is(":hidden")) { $("#secPayInfo_"+guid).slideDown("fast"); $("#secInfo_"+guid).html(text); setTimeout("$('#secPayInfo_"+guid+"').slideUp('fast');" , 8000); } } function ScrollUp(divid) { $(window).scrollTo( $("#"+divid), 800 ); } function ShowImage(imgname) { $('img[id="galPrv"]').fadeOut(); $('img[id="galPrv"]').attr('src',imgname); $('img[id="galPrv"]').fadeIn(); } function ShowImages() { window.open("http://motomobile.eu/templates/"+template+"/showimage.php", '','menubar=0, toolbar=0, location=0, scrollbars=1, resizable=1, status=0,width=640, height=600'); } function LoadImage(imgname,imginx) { if ((imgname!="") && (imginx==-1)) { imgname = imgname.replace(thumbnail,""); imgname = imgname.replace(middlethumbnail,""); } if ((imgname=="") && (imginx!=-1)) { imgname = document.getElementById('imgTh'+imginx).src; imgname = imgname.replace(thumbnail,""); } $('img[id="imgPrv"]').hide(); $('img[id="imgPrv"]').attr('src',imgname); $('img[id="imgPrv"]').fadeIn(); } function LoadImages() { oh = window.opener.document; LoadOtherImages(); LoadImage(oh.getElementById('galPrv').src,-1); } function LoadOtherImages() { oh = window.opener.document; HTML = "