//top .js
//popups 

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1225,height=800');");
}

function popUpArticle(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=566,height=800');");
}


function popUpAdvertising(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=564,height=714');");
}

function popUpAdvertising2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=684,height=465');");
}


function popUpAdvertising3(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=305,height=805');");
}

function popUpAdvertising4(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=675,height=675');");
}
function dropDown(dd_id)	{


elem = document.getElementById(dd_id);

if (elem.style.display == "none") 	{
		
		elem.style.display = "block";
		
			
									}
			else {
				
				elem.style.display = "none";
			}

}



// JavaScript Document


//load everything before executing simpleSwapSetup script

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

addLoadEvent(function() {
   
    SimpleSwapSetup();
   
})


// swap images

function SimpleSwap(el,which){
   el.src=el.getAttribute(which||"origsrc"); 
}
 

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
    // preload image
    // comment the next two lines to disable image pre-loading
     x[i].oversrc_img = new Image();
     x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}




//swap div

menu_status = new Array();
function showHide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        if(menu_status[theid] != 'show') {
           switch_id.className = 'show';
           menu_status[theid] = 'show';
        }else{
           switch_id.className = 'hide';
           menu_status[theid] = 'hide';
        }
    }
}

menu_statusShow = new Array();
function show(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        
           switch_id.className = 'show';
           menu_statusShow[theid] = 'show';
       
    }
}

menu_statusHide = new Array();
function Hide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        
           switch_id.className = 'hide';
           menu_statusHide[theid] = 'hide';
       
    }
}

//submit button 


function submitform()
{
 if(document.MyForm.onsubmit())
 {//this check triggers the validations
    document.MyForm.submit();
 }
}

// Rotate Images


function RandomImageLong(images,iparams)
{
/* si: start index 
** i: current index
** ei: end index
** cc: current count
*/
 si = 0; 
 ci=0;
 cc=0;
 imageSet = new Array();
 ei = images.length;
  for (i=1;i<ei;i++) {
    if (images.charAt(i) == ' ' || images.charAt(i) == ',') {
      imageSet[cc] = images.substring(si,i);
      cc++;
      si=i+1;
      }
    }
  ind = Math.floor(Math.random() *cc);
  document.write("<img "+iparams+" src="+imageSet[ind]+" alt=\""+imageSet[ind]+"\">");
}

// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
gSlideshowInterval = 3;
gNumberOfImages = 5;

gImages = new Array(gNumberOfImages);
gImages[0] = "images/rotate.jpg";
gImages[1] = "images/rotate4.jpg";
gImages[2] = "images/rotate5.jpg";
gImages[3] = "images/rotate6.jpg";
gImages[4] = "images/rotate8.jpg";





function canManipulateImages() {
	if (document.images)
		return true;
	else
		return false;
}
function loadSlide(imageURL) {
	if (gImageCapableBrowser) {
		document.slide.src = imageURL;
		return false;
	}
	else {
		return true;
	}
}
function nextSlide() {
	gCurrentImage = (gCurrentImage + 1) % gNumberOfImages;
	loadSlide(gImages[gCurrentImage]);
}
gImageCapableBrowser = canManipulateImages();
gCurrentImage = 0;
setInterval("nextSlide()",gSlideshowInterval * 1900);
// -->







function RandomImageLong2(images,iparams)
{
/* si: start index 
** i: current index
** ei: end index
** cc: current count
*/
 si = 0; 
 ci=0;
 cc=0;
 imageSet = new Array();
 ei = images.length;
  for (i=1;i<ei;i++) {
    if (images.charAt(i) == ' ' || images.charAt(i) == ',') {
      imageSet[cc] = images.substring(si,i);
      cc++;
      si=i+1;
      }
    }
  ind = Math.floor(Math.random() *cc);
  document.write("<img "+iparams+" src="+imageSet[ind]+" alt=\""+imageSet[ind]+"\">");
}

// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
gSlideshowInterval2 = 3;
gNumberOfImages2 = 3;

gImages2 = new Array(gNumberOfImages2);
gImages2[0] = "images/product_rotate.jpg";
gImages2[1] = "images/product_rotate2.jpg";
gImages2[2] = "images/product_rotate3.jpg";




function canManipulateImages2() {
	if (document.images)
		return true;
	else
		return false;
}
function loadSlide2(imageURL) {
	if (gImageCapableBrowser2) {
		document.slide2.src = imageURL;
		return false;
	}
	else {
		return true;
	}
}
function nextSlide2() {
	gCurrentImage2 = (gCurrentImage2 + 1) % gNumberOfImages2;
	loadSlide2(gImages2[gCurrentImage2]);
}
gImageCapableBrowser2 = canManipulateImages2();
gCurrentImage2 = 0;
setInterval("nextSlide2()",gSlideshowInterval2 * 1900);
// -->







function RandomImageLong3(images,iparams)
{
/* si: start index 
** i: current index
** ei: end index
** cc: current count
*/
 si = 0; 
 ci=0;
 cc=0;
 imageSet = new Array();
 ei = images.length;
  for (i=1;i<ei;i++) {
    if (images.charAt(i) == ' ' || images.charAt(i) == ',') {
      imageSet[cc] = images.substring(si,i);
      cc++;
      si=i+1;
      }
    }
  ind = Math.floor(Math.random() *cc);
  document.write("<a href=\"products.php\"><img "+iparams+" src="+imageSet[ind]+" alt=\""+imageSet[ind]+"\"></a>");
}

// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
gSlideshowInterval3 = 3;
gNumberOfImages3 = 2;

gImages3 = new Array(gNumberOfImages3);
gImages3[0] = "images/baitthree_5.jpg";
gImages3[1] = "images/222.jpg";





function canManipulateImages3() {
	if (document.images)
		return true;
	else
		return false;
}
function loadSlide3(imageURL) {
	if (gImageCapableBrowser3) {
		document.slide3.src = imageURL;
		return false;
	}
	else {
		return true;
	}
}
function nextSlide3() {
	gCurrentImage3 = (gCurrentImage3 + 1) % gNumberOfImages3;
	loadSlide3(gImages3[gCurrentImage3]);
}
gImageCapableBrowser3 = canManipulateImages3();
gCurrentImage3 = 0;
setInterval("nextSlide3()",gSlideshowInterval3 * 1800);
// -->


// 
var i = 1;
banner1= new Image();
banner1.src = "http://www.applearchery.com/images/baitthree_5.jpg";
banner2 = new Image();
banner2.src = "http://www.applearchery.com/images/222.jpg"; //you may add as many as needed
links = new Array
links[1] = "http://www.applearchery.com/products.php"
links[2] = "http://216.92.187.217/shop/apple_pro_string_server.php" //be sure to ad numbers consecutively
description = new Array
description[1] = ""
description[2] = "" //be sure to ad message numbers consecutively 
function startTime(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
closeTime=hours*3600+mins*60+secs;
closeTime+=6;	// How many seconds until the next banner rotation
Timer();
}
function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs
if (curTime>=closeTime){
if (i < 2){	// The number 2 is the amount of banners that you have above - adjust accordingly
i++;
document.banner.src = eval("banner" + i + ".src");
}
else{
i = 1;
document.banner.src = eval("banner" + i + ".src");
}
startTime();
}
else{
window.setTimeout("Timer()",1000)}
}
function clickLink(){
top.location = links[i]
}
function descript(){
window.status = description[i]
}
// -->


