/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Mr J | http://www.huntingground.net/ */

scrollStep=3

timerLeft=""
timerRight=""

function toLeft(id){
  document.getElementById(id).scrollLeft=0
}

function scrollDivLeft(id){
  clearTimeout(timerRight) 
  document.getElementById(id).scrollLeft+=scrollStep
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10)
}

function scrollDivRight(id){
  clearTimeout(timerLeft)
  document.getElementById(id).scrollLeft-=scrollStep
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10)
}

function toRight(id){
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth
}

function stopMe(){
  clearTimeout(timerRight) 
  clearTimeout(timerLeft)
}
// PRODUCT_DIVS
function ShowDiv(id){
  document.getElementById(id).style.display = 'block';
}
function HidesDiv(id){
  document.getElementById(id).style.display = 'none';
}


// next & prew pages


/******************************************
* Scrollable content script III- © John Davenport Scheuer
* As first seen in: http://www.dynamicdrive.com/forums - membername: jscheuer1
* Very freely adapted from Scrollable content script II- © Dynamic Drive (www.dynamicdrive.com)
* Visit http://www.dynamicdrive.com/ for full original source code
* This notice must stay intact for legal use
******************************************/

////// No Need to Edit this Head Section ///////

var iens6=document.all||document.getElementById, moveupvar, movedownvar, speed, contentid, scrollerwidth, scrollerheight, scrollerborder, upimage, downimage, sidecontrols=0;
var page = 0;
function movedown(id, speed,scrollerheight, whattodo){
var crossobj=document.getElementById? document.getElementById(id) : document.all? document.all[id] : null;
var contentheight=crossobj.offsetHeight;
if(scrollerheight < contentheight) {
document.getElementById("bottom_img").style.display =  'block';
}
if(whattodo != 1){
  page++;
if((contentheight*(-1)+speed*page)*(-1) < speed){
  document.getElementById("bottom_img").style.display = 'none';
}

                          if (page > 0) {
                            document.getElementById("top_img").style.display = "block"
                          }
if (parseInt(crossobj.style.top)>=(contentheight*(-1)+speed)){
  crossobj.style.top=parseInt(crossobj.style.top)-speed+'px';

}
 movedownvar=setTimeout("movedown('"+id+"', "+speed+")",1);
}
}

function moveup(id, speed){
  page--;
if (page < 1) {
  document.getElementById("top_img").style.display = "none"
}
                          if (page == 0) {
                            document.getElementById("bottom_img").style.display = "block"
                          }
var crossobj=document.getElementById? document.getElementById(id) : document.all? document.all[id] : null;
if(speed < crossobj.offsetHeight) {
document.getElementById("bottom_img").style.display =  'block';
}
if (parseInt(crossobj.style.top)+speed<=0){
  crossobj.style.top=parseInt(crossobj.style.top)+speed+'px';

}
 moveupvar=setTimeout("moveup('"+id+"', "+speed+")",1);
}

function textsizepoll(id){
var crossobj=document.getElementById? document.getElementById(id) : document.all? document.all[id] : null;
var contentheight=crossobj.offsetHeight;
// if (parseInt(crossobj.style.top)<(contentheight*(-1)+crossobj.parentNode.offsetHeight-9))
// crossobj.style.top=contentheight*(-1)+crossobj.parentNode.offsetHeight-100+'px';
// else if (parseInt(crossobj.style.top)>1)
// crossobj.style.top=0;
}

function topwrite(){
if (iens6){
if(sidecontrols)
document.write('<table class="'+contentid+'" style="border-collapse:collapse;border:'+scrollerborder.join(' ')+';" ><tr><td><div class="'+contentid+'" style="position:relative;width:'+scrollerwidth+'px;height:'+scrollerheight+'px;overflow:hidden;">\n');
else
document.write('<div class="'+contentid+'" style="position:relative;width:'+scrollerwidth+'px;height:'+scrollerheight+'px;border:'+scrollerborder.join(' ')+';overflow:hidden;">\n');
document.write('<div id="'+contentid+'" style="position:absolute;width:'+[scrollerwidth-5]+'px;left:0;top:0;">\n');
}
}

function bottomwrite(speed, contentid, style){

if(style != 1){
  if (iens6){
  document.write('<\/div><\/div>\n');
  if(sidecontrols){
  document.write('<\/td><td style="border-left:'+scrollerborder.join(' ')+';"><table style="height:'+scrollerheight+'px;border-collapse:collapse;"><tr><td style="text-align:left;height:48%;vertical-align:top;">\n');
  document.write('<a href="javascript:void(0);" onmouseover="moveup(\''+contentid+'\', '+speed+')" onmouseout="clearTimeout(moveupvar)"><img class="uparrow" style="padding:1ex;" src="'+upimage+'" border="0"><\/a><\/td><\/tr><tr><td style="text-align:left;height:48%;vertical-align:bottom;"><a href="javascript:void(0);" onmouseover="movedown(\''+contentid+'\', '+speed+', '+scrollerheight+')" onmouseout="clearTimeout(movedownvar)"><img class="downarrow" style="padding:1ex;padding-bottom:.75ex;" src="'+downimage+'" border="0"><\/a><\/td><\/tr>\n');
  document.write('<\/table><\/td><\/tr></table>\n');
  }
  else {
  document.write('<table class="'+contentid+'" style="width:'+scrollerwidth+'px;"><td style="text-align:right;height:1em;">\n');
  document.write('<img id="top_img" class="uparrow" style="cursor: pointer;  display: none;" src="'+upimage+'" border="0" onClick="moveup(\''+contentid+'\', '+speed+'); clearTimeout(moveupvar)" align="left"> <img id="bottom_img" class="downarrow" style="cursor: pointer;  display: none;" src="'+downimage+'" border="0" onClick=" movedown(\''+contentid+'\', '+speed+', '+scrollerheight+'); clearTimeout(movedownvar)" align="right"><\/td><\/tr>\n');
  document.write('<\/table>\n');
  }
  if(!window.opera){
  setInterval("textsizepoll('"+contentid+"')", 700);
  }
  var crossobj=document.getElementById? document.getElementById(contentid) : document.all? document.all[contentid] : null;
  
  
  }
}
else {
  if (iens6){
  document.write('<\/div><\/div>\n');
  if(sidecontrols){
  document.write('<\/td><td style="border-left:'+scrollerborder.join(' ')+';"><table style="height:'+scrollerheight+'px;border-collapse:collapse;"><tr><td style="text-align:left;height:48%;vertical-align:top;">\n');
  document.write('<a href="javascript:void(0);" onmouseover="moveup(\''+contentid+'\', '+speed+')" onmouseout="clearTimeout(moveupvar)"><img class="uparrow" style="padding:1ex;" src="'+upimage+'" border="0"><\/a><\/td><\/tr><tr><td style="text-align:left;height:48%;vertical-align:bottom;"><a href="javascript:void(0);" onmouseover="movedown(\''+contentid+'\', '+speed+', '+scrollerheight+')" onmouseout="clearTimeout(movedownvar)"><img class="downarrow" style="padding:1ex;padding-bottom:.75ex;" src="'+downimage+'" border="0"><\/a><\/td><\/tr>\n');
  document.write('<\/table><\/td><\/tr></table>\n');
  }
  else {
  }
  if(!window.opera){
  setInterval("textsizepoll('"+contentid+"')", 70);
  }
  var crossobj=document.getElementById? document.getElementById(contentid) : document.all? document.all[contentid] : null;
  
  
  }
}
}


// end of next & prew pages

    function GetOptions(this_id, change_next, sections, mode_form, selected_state){
        if  ($("#"+this_id).val() =='')  $("#"+change_next).attr("disabled","disabled"); else $("#"+change_next).removeAttr("disabled", "");

        $("#ajaxindicator").ajaxStart( function() { $(this).html("<img src=\"js/indicator.gif\" width=16 height=16 >");  $(this).show(); } );
        $("#ajaxindicator").ajaxStop( function() { $(this).html(''); $(this).hide(); } );

        $.ajax({
            url: base_url + "get_select.php?id="+$(this_id).val()+"&section="+sections+"&form="+mode_form+"&selected="+selected_state,
            cache: false,
            success: function(html){
            $(change_next).html();
            $(change_next).html(html);
            }
        });
   } 
