﻿
//this js file loads structure for scrolling image panel

var kcxmlob;    
var uidxmlob;    
var loggeduser;




// JScript File
var arimgs= new Array();
var aruids= new Array();
//part of converyor belt method

//Specify the slider's width (in pixels) 300px default

//alert();
var sliderwidth="400px";
//Specify the slider's height 150px default
var sliderheight="80px"; 
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=1;
//configure background color:
slidebgcolor="#";

//Specify the slider's images
var leftrightslide=new Array();


//Specify gap between each image (use HTML):
var imagegap="   ";

//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=12;



var finalslide='';

var actualwidth='';
var cross_slide;
var cross_slide2;

var ns_slide;

for(b=0;b<10;b++)
    leftrightslide[b]='  <b><font size=2>'+eval(b+1)+'.</font></b> <img id="iii'+eval(b+1)+'" src="http://flexo.kneps.com/album/loadin.gif" height="76px" border=2 onclick="alert(\'Arey!! Thats still under construction...\');" onMouseover="msname=this.id;showmytip();" onMouseout="hideddrivetip()">';


leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>';


////NO NEED TO EDIT BELOW THIS LINE<----------- I hav changed things below this line only...

var copyspeed=slidespeed;
var direc=1;
var zctr=0;
var iedom=document.all||document.getElementById;

function setapwidth()
{
    sliderwidth=document.getElementById("scrltd").offsetWidth-50 + "px"; 
    document.getElementById("slbdy1").style.width=sliderwidth;
    document.getElementById("slbdy2").style.width=sliderwidth;
}

function createscroll()
{
    if(document.all)
    {
        
        sliderwidth=document.getElementById("scrltd").offsetWidth-50 + "px"; 
    //    setapwidth();
     }   
    else
        sliderwidth="435px";//document.getElementById("scrltd").offsetWidth-50;
        
    var scrollbody="";
    if (iedom)
        scrollbody='<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px;">'+leftrightslide+'</span>';
  

if (iedom||document.layers)
{
    with (document)
    {
        
        scrollbody+='<table border="0" cellspacing="0" cellpadding="0"><td style="border-right: black 2px solid"><img src="stuff/fs/aleft.gif" onMouseover="direc=1; copyspeed=4;" onMouseout="copyspeed=slidespeed"/><br/><img src="stuff/fs/aright.gif" onMouseover="direc=-1;copyspeed=-4;" onMouseout="copyspeed=-slidespeed"/><br/><img src="stuff/fs/pause.gif" onmouseover="copyspeed=0;"/></td><td valign="top">';
        if (iedom)
        {
            
            scrollbody+='<div id="slbdy1" style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden;">';
            scrollbody+='<div id="slbdy2" style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+';" onMouseover="copyspeed=0" onMouseout="copyspeed=direc">';
            scrollbody+='<div id="test2" style="position:absolute;left:0px;top:0px; "></div>';
            scrollbody+='<div id="test3" style="position:absolute;left:-900px;top:0px;"></div>';
            scrollbody+='</div></div>';
        }
        else if (document.layers)
        {
            scrollbody+='<ilayer id="slbdyl1" "width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>';
            scrollbody+='<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=direc"></layer>';
            scrollbody+='<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=direc"></layer>';
            scrollbody+='</ilayer>';
        }
        scrollbody+='</td><td style="border-left: black 2px solid"><img src="stuff/fs/pause.gif" onmouseover="copyspeed=0;"/><br/><img src="stuff/fs/aleft.gif" onMouseover="direc=1;copyspeed=4;" onMouseout="copyspeed=slidespeed"/><br/><img src="stuff/fs/aright.gif" onMouseover="direc=-1;copyspeed=-4;" onMouseout="copyspeed=-slidespeed"/></td></table>';
    }
}

//document.all.imagescrollspan.innerHTML=scrollbody;
document.getElementById("imagescrollspan").innerHTML=scrollbody;

    
}

function changeimgnames(stra,mod)
{
    var bstr = new String(stra);
    
    if(mod==1)
    {
        while(bstr.search("iii")>0)
            bstr=bstr.replace("iii","imga");
    }
    else if(mod==2)
    {
        while(bstr.search("iii")>0)
            bstr=bstr.replace("iii","imgb");
    }
    return (bstr);
}

function fillup()
{
    
    
    if (iedom)
    {
        cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2;
        cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3;
        cross_slide.innerHTML=changeimgnames(leftrightslide,1);
        cross_slide2.innerHTML=changeimgnames(leftrightslide,2);
        //actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("test2").offsetWidth
        //actualwidth=getwid();
        cross_slide2.style.left=cross_slide.offsetWidth+slideshowgap+"px";
    }
    else if (document.layers)
    {
        ns_slide=document.ns_slidemenu.document.ns_slidemenu2;
        ns_slide2=document.ns_slidemenu.document.ns_slidemenu3;
        ns_slide.document.write(leftrightslide);
        ns_slide.document.close();
        //actualwidth=ns_slide.document.width
        ns_slide2.left=ns_slide.document.width+slideshowgap;
        ns_slide2.document.write(leftrightslide);
        ns_slide2.document.close();
    }
    zctr=0;
    lefttime=setInterval("slideleft()",30);
}

function slideleft()
{
    //alert('1');
    setapwidth();
    if (iedom)
    {
       /* if(copyspeed==0)
        {
            
            if(zctr++>170)
            {
                copyspeed=direc;
                zctr=0;
            }
        }*/    
        
        if ( copyspeed<0)
        {     
            
            if (parseInt(cross_slide.style.left)<0)
                cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px";
            else
                cross_slide2.style.left=parseInt(cross_slide.style.left)-cross_slide2.offsetWidth-slideshowgap+"px";
             
            if (parseInt(cross_slide2.style.left)<0)
                cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px";
            else
                cross_slide.style.left=parseInt(cross_slide2.style.left)-cross_slide.offsetWidth-slideshowgap+"px";
                
        }
        else
        {
            
            if (parseInt(cross_slide.style.left)>(cross_slide.offsetWidth*(-1)))
                cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px";
            else 
                cross_slide.style.left=parseInt(cross_slide2.style.left)+cross_slide.offsetWidth+slideshowgap+"px";
     
            if (parseInt(cross_slide2.style.left)>(cross_slide2.offsetWidth*(-1)))
                cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px";
            else
                cross_slide2.style.left=parseInt(cross_slide.style.left)+cross_slide2.offsetWidth+slideshowgap+"px";
        }
    
    }
    else if (document.layers)
    {
        if ( copyspeed<0)
        {     
            
            if (ns_slide.left<sliderwidth)
                ns_slide.left+=copyspeed;
            else
                ns_slide.left=ns_slide2.left+ns_slide.document.width+slideshowgap;
        
            if (ns_slide2.left<sliderwidth)
                ns_slide2.left+=copyspeed;
            else
                ns_slide2.left=ns_slide.left+ns_slide.document.width+slideshowgap;
            
        }
        else
        {
            
            if (ns_slide.left>(ns_slide.document.width*(-1)+8))
                ns_slide.left-=copyspeed;
            else
                ns_slide.left=ns_slide2.left+ns_slide.document.width+slideshowgap;
            
            if (ns_slide2.left>(ns_slide.document.width*(-1)+8))
                ns_slide2.left-=copyspeed;
            else
                ns_slide2.left=ns_slide.left+ns_slide.document.width+slideshowgap;
        }
    }
}

//end of part conveyor belt

function initmypage()
{

    
    var h;
    for(h=0;h<10;h++)
        arimgs[h]="loadin.gif";
   
    createscroll();
    fillup();
    loadimgque();
    
}
function getloggeduid()
{
 
    
    uidxmlob=new getXmlHttpObject();
    uidxmlob.open("GET","imgRefresh.aspx?sid=" + Math.random()+"&foruid=1", true);
    uidxmlob.onreadystatechange = uidHttpRecieve;
    uidxmlob.send(null);
}

function uidHttpRecieve() 
{ 

	if (uidxmlob.readyState == 4 || uidxmlob.readyState == 0) 
	{
		
		var newone = new String(uidxmlob.responseText);
	    
	    if(newone!="")
	    {
	      
	        loggeduser=newone;
	       // alert(loggeduser);
		}
    }
}

function getXmlHttpObject()
{
    var xmlhttp;
    try 
    {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e)
    {
        try
        {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch (E)
		{
	        try
	        {
		        xmlhttp = new XMLHttpRequest();
	        }catch (ex)
	        {
		        alert("your browser does not support ajax!");
		        xmlhttp = false;
	        }
        }
    }
    return xmlhttp;
}





function imgload()
{
    if(iedom)
    {
        for(u=0;u<10;u++)
        {
            document.getElementById("imga"+(u+1)).src="http://flexo.kneps.com/album/"+arimgs[u];
            document.getElementById("imgb"+(u+1)).src="http://flexo.kneps.com/album/"+arimgs[u];
        }
       slideleft();
    }
    else
    {
        alert("Hewlow");
        alert("Your browser is not supporting our scripts.. kindly uninstall it!");
        
    }
}