﻿
/**************** Code to display Sale details for a list of users ****************/

/* This script and many more are available free online at
	The JavaScript Source!! http://javascript.internet.com
	Created by: Robert Suppenbach ::webdevel.deezhosts.net */

	var toScroll=new Array()
	var ie=document.all
	var dom=document.getElementById
	var firstNews_obj;
	var secondNews_obj;

	function newsScroll(name){
	var c=this; c.name=name; c.mc=0; c.i=2;
	return this;
	}

	newsScroll.prototype.addItem = function(text,link,font,fontSize,fontStyle){
	var c = this;
	if (link !=''){
		if (font != '')
		toScroll[c.mc]="<a href='"+link+"'><font face='"+font+"' size='"+fontSize+"' Class='"+fontStyle+"'>"+text+"</font></a>";
		else
		toScroll[c.mc]="<a href='"+link+"'><font Class='"+fontStyle+"'>"+text+"</font></a>";
	}
	else { 
		if (font != '')
		toScroll[c.mc]="<font face='"+font+"' size='"+fontSize+"' Class='"+fontStyle+"'>"+text+"</font>";
		else
		toScroll[c.mc]="<font Class='"+fontStyle+"'>"+text+"</font>";
	}
	c.mc++;
	}

	newsScroll.prototype.construct = function(){
	var c = this; theWidth = c.scrollerwidth; theHeight=c.scrollerheight; thebgColor = c.scrollerbgcolor; theBackground =c.scrollerbackground; theDelay=c.scrollerdelay;
	scroll_obj=eval(c.name);        
	if (ie||dom){
		document.writeln('<div id="main2" style="position:relative;width:'+theWidth+';height:'+theHeight+';overflow:hidden;background-color:'+thebgColor+' ;background-image:url('+theBackground+')">')
		document.writeln('<div style="position:absolute;width:'+theWidth+';height:'+theHeight+';clip:rect(0 '+theWidth+' '+theHeight+' 0);left:0;top:10">')
		document.writeln('<div id="firstNews" style="position:absolute;width:'+theWidth+';left:0;top:15">')
		document.write(toScroll[0])
		document.writeln('</div>')
		document.writeln('<div id="secondNews" style="position:absolute;width:'+theWidth+';left:0;top:0;visibility:hidden">')
		document.write(toScroll[dyndetermine=(toScroll.length==1)? 0 : 1])
		document.writeln('</div>')
		document.writeln('</div>')
		document.writeln('</div>')
	}
	}

	newsScroll.prototype.move = function(whichdiv){
	var c = this; theDelay = c.scrollerdelay; theHeight = c.scrollerheight; 
	scroll_obj=eval(c.name);
	tdiv=eval(whichdiv)

	if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
		tdiv.style.top=0+"px"
		setTimeout("scroll_obj.move(tdiv)",theDelay)
		setTimeout("scroll_obj.move2(secondNews_obj)",theDelay)
		//document.write('Got Milk?')
	return
	}
	if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
		tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
		setTimeout("scroll_obj.move(tdiv)",50)
	}
	else {
		tdiv.style.top=parseInt(theHeight)+"px"
		tdiv.innerHTML=toScroll[c.i]
		if (c.i==toScroll.length-1)
		c.i=0
		else
		c.i++
	}
	}

	newsScroll.prototype.move2 = function(whichdiv){
	var c = this; theDelay = c.scrollerdelay; theHeight= c.scrollerheight;
	scroll_obj=eval(c.name);
	tdiv2=eval(whichdiv)

	if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
		tdiv2.style.top=0+"px"
		setTimeout("scroll_obj.move2(tdiv2)",theDelay)
		setTimeout("scroll_obj.move(firstNews_obj)",theDelay)
		return
	}
	if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
		tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
		setTimeout("scroll_obj.move2(secondNews_obj)",50)
	}
	else {
		tdiv2.style.top=parseInt(theHeight)+"px"
		tdiv2.innerHTML=toScroll[c.i]
		if (c.i==toScroll.length-1)
		c.i=0
		else
		c.i++
	}
	}

	newsScroll.prototype.startScroll = function(){
	var c = this;
	scroll_obj=eval(c.name);        
	  
	if (toScroll.length >2)
		c.i = 2;
	else
		c.i = 0;
	  
	firstNews_obj=ie? firstNews : document.getElementById("firstNews")
	secondNews_obj=ie? secondNews : document.getElementById("secondNews")
	setTimeout("scroll_obj.move(firstNews_obj)",c.scrollerDelay);
	secondNews_obj.style.top=theHeight;
	secondNews_obj.style.visibility='visible'
	}
	
	
	
/**************** Code specific to ForumImageRotator ********************/
	//creating a array of the image object
	// This step is generated by aspx.cs file
	
	var isSlideShowStarted = true;
	var messageId = 0;
	var imageSrc = '';
	var imageSrc2 = '';
	var num2 = 0;
	var num = 0;
var image='';
	var image2='';
	var latestImageLink;
	
	function image_effects()
	{
		document.images.largeImage.filters.revealTrans.Transition= 1;
		document.images.largeImage.filters.revealTrans.apply()
		document.images.largeImage.filters.revealTrans.play()			  
	}
	
	function slideshow_automatic_set()
	{
		if (image.length == 0)							
			alert('Images are not loaded! Select the gallery to load images.')
		else
		{					
			isSlideShowStarted = !isSlideShowStarted;
			var buttonSlideShow = document.getElementById('SlideShow');
			if(isSlideShowStarted)
				buttonSlideShow.value = 'Stop slide show';
			else
				buttonSlideShow.value = 'Start slide show';						
			slideshow_automatic();
		}
	}
	
	function slideshow_start()
	{
	    slideshow_automatic();
	    slideshow_automatic2();
	}
	
	function slideshow_automatic()
	{ 			
		if(isSlideShowStarted)
		{					
			if (num<image.length)
			{	
			    var schemeAndProtocalLength = 9;
			    var domainAndAppApth = document.URL.toLowerCase().replace("http://", "https://");
			    domainAndAppApth = domainAndAppApth.substr(0, domainAndAppApth.indexOf("/", schemeAndProtocalLength + document.domain.length-1));
			    imageSrc = image[0].substring(0, image[0].indexOf("|"));
				//alert(domainAndAppApth);
				messageId = image[0].substring(image[0].indexOf("|") + 1, image[0].length);
				latestImageLink = document.getElementById("imageLink");
				latestImageLink.href = domainAndAppApth + '/Sec/Auth/Forum.aspx?fty=fpo&tid=&topic=&thread=' + '' + '&thid=' + messageId;
				document.images.largeImage.alt = 'Click to view the post';
				//alert(imageSrc);
				document.images.largeImage.src = imageSrc;							
				num++
				if (num==image.length) 
					num=0;
				timeDelay=setTimeout("slideshow_automatic()", "2000") ;
				imageSrc = image[num].substring(0, image[num].indexOf("|"));
				messageId = image[num].substring(image[num].indexOf("|") + 1, image[num].length);
				document.images.largeImage.src=imageSrc;   
				latestImageLink.href = domainAndAppApth + '/Sec/Auth/Forum.aspx?fty=fpo&tid=&topic=&thread=' + '' + '&thid=' + messageId;
				document.images.largeImage.alt = 'Click to view the post';
			}		
		}					
		else
			isSlideShowStarted = false
	}

    function slideshow_automatic2()
	{
		if(isSlideShowStarted)
		{						
			if (num2<image2.length)
			{	
    		    imageSrc2 = image2[0];
				//messageId = image[0].substring(image[0].indexOf("|") + 1, image[0].length);
				//latestImageLink = document.getElementById("imageLink2");
				//latestImageLink.href = 'ForumPosts.aspx?topic=Not available&thid=' + messageId;
				document.images.largeImage2.alt = 'Click here to view the post';
				
				document.images.largeImage2.src = imageSrc2;							
				num2++
				if (num2==image2.length) 
					num2=0;
				timeDelay2=setTimeout("slideshow_automatic2()",3000) ;
				imageSrc2 = image2[num2];
				//messageId = image2[num2].substring(image[num].indexOf("|") + 1, image[num].length);
				document.images.largeImage2.src=imageSrc2;   
				//latestImageLink.href = 'ForumPosts.aspx?topic=Not available&thid=' + messageId;
				document.images.largeImage2.alt = 'Click here to view the post';
			}	
		}					
		else
			isSlideShowStarted = false
	}
	
	function ShowLargeImage(image, description)
	{
		var largeImage = document.getElementById("largeImage");
		if(image != 'from load')				
		{	
			largeImage.src = image;
		}
		else
		{	
			largeImage.src = '..\\images\\generic\\pix.gif';
		}
		
		var imageDescription = document.getElementById("description");
		if(description != 'OnLoad')
			imageDescription.value = 'Description: ' + description;			
		
	}
	
	function ShowProductImage(image, description)
	{
		var largeImage = document.getElementById("imgProductMedium");
		if(image != 'from load')				
		{	
			largeImage.src = image;
		}
		else
		{	
			largeImage.src = '..\\images\\generic\\pix.gif';
		}
		
		var imageDescription = document.getElementById("description");
		if(description != 'OnLoad')
			imageDescription.value = 'Description: ' + description;			
		
	}
	
