//Ennek a scriptnek az eredetije a hotscripts.com-ról való //sajnos elfelejtettem a nevet. //A script egy vagy tobb kepet belülről megadhato //sebesseggel gorget ide-oda egy kívulről //megadható szélességü tablazat cellaban // globals - used by pans var td_width=new Array(); var td_height=new Array(); var pan_td_id=new Array(); var pan_xpos=new Array(); var pan_old_px=new Array(); var pan_dir=new Array(); var pan_image=new Array(); function kgpanorama(n,img,tablew) { // get the image info getPan(n,img); // write the table writePan(n,tablew,img); // this loads up the pan loadPan(n,img); // this starts the pan moving startPan(n); } function getPan(n,img) { var pan_td="pan"+n; pan_image[n] = new Image(); pan_image[n].src = img; // need to manually load the image so it show up on the screen td_width[n]=pan_image[n].width; td_height[n]=pan_image[n].height; // alert('height=' + td_height[n]+ // '; width=' + td_width[n]); } function startPan(n) { pan_dir[n]=-1; pan_xpos[n]=0; pan_old_px[n]=0; pan_drift(n); } function writePan(n,tablew,img) { var hh=td_height[n]; if (hh==null||hh<=0) td_height[n]=101; document.write(''); document.write('
 
'); } // function to load image into the table background function loadPan(n,td_img) { var pan_td="pan"+n; pan_td_id[n]=document.getElementById(pan_td); if (pan_td_id[n]==null) { //alert("huh??? 1"); return; } // set the background for the td pan_td_id[n].background=td_img; pan_td_id[n].style.backgroundImage="url("+td_img+")"; // check to see if loaded. if (pan_td_id[n].background==null) { //alert("huh??? 2"); return; } // got the loop // now we have everything we need pan_td_id[n].style.backgroundPosition= "0px 0px"; pan_td_id[n].height=td_height[n]; pan_td_id[n].style.height=td_height[n]; } function pan_drift(n) { // check to see if there is a new height to the picture var hh=pan_image[n].height; if (hh!=null&&hh>0&&pan_td_id[n].height==101) { // finally got a size - resize the table td_height[n]=pan_image[n].height; pan_td_id[n].height=td_height[n]; pan_td_id[n].style.height=td_height[n]; td_width[n]=pan_image[n].width; } // drifts to right if (pan_dir[n]==0) { return; } // calculate drift position //nem körbe jár csak oda vissza! pan_xpos[n]=pan_xpos[n]+(pan_dir[n]*2); if (pan_xpos[n]>=0 && td_width[n]>0) { // pan_xpos[n]=pan_xpos[n];//-td_width[n]; pan_dir[n]=pan_dir[n]*-1; } var pan_tbl="pan_tbl"+n; tbl=document.getElementById(pan_tbl); if (pan_xpos[n]<=tbl.width-pan_image[n].width) { // pan_xpos[n]=pan_xpos[n];//+td_width[n]; pan_dir[n]=pan_dir[n]*-1; } var posit=""+pan_xpos[n]+"px 0px"; pan_td_id[n].style.backgroundPosition=posit; //sebesseg beallitas setTimeout("pan_drift("+n+")",30); }