﻿// JScript File for viewing advertisements

var adsImages=new Array();
var adsLinks=new Array();
var IsNewWindow=new Array();
var slideShowSpeed=2000; // its default value
var whichlink=0;
var whichimage=0;

function SlideShowAds(){
    for (i=0;i<SlideShowAds.arguments.length;i++){
        adsImages[i]=new Image()
        adsImages[i].src=SlideShowAds.arguments[i]
    }
}

function SlideShowLinks(){
    for (i=0;i<SlideShowLinks.arguments.length;i++)
        adsLinks[i]=SlideShowLinks.arguments[i]
}

function LinksIsNewWindow(){
    for (i=0;i<LinksIsNewWindow.arguments.length;i++)
        IsNewWindow[i]=LinksIsNewWindow.arguments[i]
}

function GotoAd(){
if(IsNewWindow[whichlink])
{   if (!window.winslide||winslide.closed)
    winslide=window.open(adsLinks[whichlink])
    else
    winslide.location=adsLinks[whichlink]
    winslide.focus()
 }
 else
 {
 window.navigate(adsLinks[whichlink]);
 }
}

function SlideIt(){
    if (!document.images)
    return
    document.images.Ad.src=adsImages[whichimage].src
    whichlink=whichimage
    if (whichimage<adsImages.length-1)
        whichimage++
    else
        whichimage=0
    setTimeout("SlideIt()",slideShowSpeed)
}


function GetObj(ObjName)
{   var frm=document.forms[0] ;
    var Obj=null;
    if(frm)
    {   for(var i=0;i < frm.elements.length;i++)
        {    if(frm.elements[i].name.indexOf(ObjName)>-1) 
             {   Obj= frm.elements[i];
                    break;
             }
        }
    }
    return Obj;
}

function SubmitGo()
{
    var Obj=GetObj('txtSearch');
    if(Obj) {
        if(Obj.value!='') {window.navigate('/Guest/SearchResults.aspx?K=' + Obj.value);}
        else {window.navigate('/Guest/SearchResults.aspx?');}
            }
    return false;
}

/*
if (document.layers) document.captureEvents(Event.KEYPRESS);
window.onkeypress = keyhandler;

function keyhandler(e) {
   var event = e ? e : window.event;
   if (event.keyCode == 13) return false;
   }
   event.returnValue=false;
    event.cancel=true;   
   
*/


/***********************************************
* DHTML Script by Niv Froehlich
* Copyright 2005.  All rights Reserved.
***********************************************/
//(Do not edit)
var photos=new Array()
var photoslink=new Array()
var client=new Array()
var desc=new Array()
var which=0
var showInProgress = 0
var mainImage = 0


//Specify slideshow delay (in milliseconds)
var slideDelay = 5000

// specify the path to folder holding large images
var largePhotoPath ="/images/"

//define images. You can have as many as you want:
photos[0]="home1.jpg"
photos[1]="home2.jpg"
photos[2]="home3.jpg"
photos[3]="home4.jpg"
photos[4]="home5.jpg"
photos[5]="home6.jpg"
photos[6]="home7.jpg"
photos[7]="home8.jpg"
photos[8]="home9.jpg"
photos[9]="home10.jpg"
photos[10]="home11.jpg"


//Specify whether images should be linked or not (1=linked, 0=not)
var linkornot=1

//Set corresponding URLs for above images. Define ONLY if variable linkornot equals "1"
photoslink[0]="/Guest/Product.aspx?IDS=XVhJt6MPcBkMz5f2niBRkg%3d%3d"
photoslink[1]="/Guest/Product.aspx?IDS=wP6d9dn5A47PDOgAUEL7RQ%3d%3d"
photoslink[2]="/Guest/Product.aspx?IDS=IBV6z11wH41CdB7wDyqz6A%3d%3d"
photoslink[3]="/Guest/Product.aspx?IDS=H73cRCaS996BWokLslFU2A%3d%3d"
photoslink[4]="/Guest/Product.aspx?IDS=00yxC3ikO5RaGBDgXNyP9g%3d%3d"
photoslink[5]="/Guest/Product.aspx?IDS=DaecqgQkMJkiuTx0aUQpKQ%3d%3d"
photoslink[6]="/Guest/Product.aspx?IDS=rw8xCkzyK7kyHzL6fqMUvw%3d%3d"
photoslink[7]="/Guest/Product.aspx?IDS=YeKO3hdvHIuUjuQve0UGJg%3d%3d"
photoslink[8]="/Guest/Product.aspx?IDS=wAyk5UhopGqs8DiXVIfYsw%3d%3d"
photoslink[9]="/Guest/Product.aspx?IDS=XBs6wUmaZ57bc4FXjBX1Pg=="
photoslink[10]="/Guest/Product.aspx?IDS=JCO8GHPZGX%2b9NGIjtMpnTQ%3d%3d"

//do NOT edit pass this line

//auto update totalSlides
totalSlides = photos.length

//append path for images
for (i = 1; i <= totalSlides; i++)
{
photos[i-1]= largePhotoPath + photos[i-1];
}

var preloadedimages=new Array()

for (i=0;i<photos.length;i++)
{
	preloadedimages[i]=new Image()
	preloadedimages[i].src=photos[i]
}


function applyeffect()
{
	if (document.all && mainImage.filters)
	{
	mainImage.filters.revealTrans.Transition=12
	mainImage.filters.revealTrans.stop()
	mainImage.filters.revealTrans.apply()
	}
}

function playeffect()
{
if (document.all && mainImage.filters)
mainImage.filters.revealTrans.play()
}

function keeptrack()
{
window.status="Welcome to SRP control systems ltd."
}

function backward()
{
	stopSlideShow()
	if (which>0)
	{
	which--
	applyeffect()
	document.images.mainImage.src=photos[which]
	playeffect()
	keeptrack()
	}
}

function forward()
{
	stopSlideShow()
	if (which<photos.length-1)
	{
	which++
	applyeffect()
	document.images.mainImage.src=photos[which]
	modifyText()
	playeffect()
	keeptrack()
	}
}

function slideByNumber(slideNo)
{
	which = slideNo - 1
	stopSlideShow()
	applyeffect()
	document.images.mainImage.src=photos[which]
	playeffect()
	keeptrack()
}

function autoSlideShow()
{

	if (which<photos.length-1)
	{
	which++
	applyeffect()
	document.images.mainImage.src=photos[which]
	playeffect()
	keeptrack()
	}
	else
	{
	which=-1
	autoSlideShow()
	}
}

function Timer2()
{
  autoSlideShow()
}

function begSlideShow()
{

	if (showInProgress!=1)
	{
	showInProgress=1

// set the interval for photo change
	gTimer2 = null;
	gTimer2 = window.setInterval("Timer2()",slideDelay);
	}
	else
	{
	stopSlideShow()
	}
}

function stopSlideShow()
{
	if (showInProgress==1)
	{
	window.clearInterval(gTimer2);
	showInProgress=0
	}
}

function transport()
{
	location.href(photoslink[which])
}





