var videoCnt=0, videoIteration, videoStop;

	function initVideoCnt(cnt)
	{
			videoCnt = cnt ;
			videoIteration=1;
			videoStop = videoCnt-2;
			$("a.frontVideo").css({cursor:"pointer"});
			$("div.moveGallery").css({left: '0px'});
	}	
		

	function galleryFront()
	{
		if(videoCnt==0)
		{	
			//initVideoCnt($("#numberofVideos").html());
			initVideoCnt(8);
		}	
			
		var divLeft = parseInt($("div.moveGallery").css('left'));
		var divBoundry = parseInt($("div.image_collection").css('width'))-80;
		
		if(videoIteration < videoStop)
		{
			//alert("videoIteration - " + videoIteration +" , videoIteration - " + videoIteration);
			$("div.moveGallery").animate({left: '-=221px'}, 1000);
			$("a.backVideo").css({cursor:"pointer"});
		}
		else
		{
			videoIteration = videoStop-1;;
			$("a.frontVideo").css({cursor:"text"});
		}

		videoIteration++;
	}

	function galleryBack()
	{
		if(videoCnt==0)
		{		
			//initVideoCnt($("#numberofVideos").html());
			initVideoCnt(8);
		}
		
		var divLeft = parseInt($("div.moveGallery").css('left'));
		var divBoundry = parseInt($("div.image_collection").css('width'))+80;
		
		if(videoIteration > 1)
		{
			$("div.moveGallery").animate({left: '+=221px'}, 1000);
			$("a.frontVideo").css({cursor:"pointer"});
		}
		else
		{
			videoIteration = 2;
			$("a.backVideo").css({cursor:"text"});
		}
		videoIteration--;
	}
	


	
var arr = new Array();
	arr[0] = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="266" id="player" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="images/vplayer.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="images/vplayer.swf" quality="high" bgcolor="#ffffff" width="320" height="266" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

		
	
function showVideo(divid,alink,xpos,ypos)
{
	var browserName=navigator.appName;
	if (browserName!="Microsoft Internet Explorer")
	{
		ypos = ypos - 85
	}
	var obj_box			= document.getElementById("flashcont_box");
	var obj				= document.getElementById("flashcont1");
	obj.innerHTML   = "";
	var cord			= getAnchorPosition(alink);
	cord.y				= cord.y+ypos;
	cord.x				= cord.x+xpos;
	obj_box.style.top		= eval("'"+cord.y + "px'"); 
	obj_box.style.left		= eval("'"+cord.x + "px'"); 
	obj_box.style.visibility= "visible";
	obj_box.style.display	= "block"; // when show
	obj_box.style.zIndex	= "100000";
	obj.innerHTML = arr[divid-1];
}
function hideVideo(divid)
{
	var obj_box			= document.getElementById("flashcont_box");
	var obj				= document.getElementById("flashcont1");
	obj.innerHTML = "";
	obj_box.style.display	= "none"; 
}

var ival=0;
function showStory(photoid)
{
	var objFlash	= document.getElementById('story_flash');
	if(ival != photoid)
	{
		ival	= photoid;
		//para = "images/player.swf?videoName=images/video/testi"+photoid+".flv&playValue=true"; 
		//para = "images/player.swf?movieName=http://whatarage.com/wip/asthtva_html/images/video/testi"+photoid+".flv&title=test&autoPlay=true";

		para = "images/player.swf?movieName=http://www.asthtva.com/images/video/testi"+photoid+".flv&title=test&autoPlay=true";

		scriptvar = eval("AC_SSS_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width', '221','height', '188','src', '"+para+"','quality', 'high','pluginspage', 'http://www.macromedia.com/go/getflashplayer','align', 'middle','play', 'true','loop', 'true','scale', 'showall','wmode', 'transparent','flashvars', '"+para+"','devicefont', 'false','id', 'player','bgcolor', '#ffffff','name', 'player','menu', 'true','allowFullScreen', 'false','allowScriptAccess','sameDomain','movie', '"+para+"','salign', '')");

		objFlash.innerHTML = scriptvar;
	}

	for (i=1;i<=18;i++)
	{
		icont = document.getElementById('i'+i);
		if (photoid==i)
		{
			icont.className='fade_off';
		}
		else
		{
			icont.className='fade_on';
		}
	}
}


//var arrProductText	=	new Array();
//arrProductText['1']	=	"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam";
//arrProductText['2']	=	"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy ";
//arrProductText['3']	=	"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt";

var arrImgs = new Array('1.jpg','2.jpg','3.jpg','4.jpg','5.jpg','6.jpg','7.jpg','8.jpg','9.jpg');
var prev_img="1";
function setImg(imgId)
{
	objImg		=	document.getElementById("zoomImg");
	objImg.src	=	'images/'+imgId+'.jpg';
	
	//document.getElementById("prodDesc").innerHTML = arrProductText[imgId];

	objThumb		=	document.getElementById("thumb"+imgId);
	objThumb.setAttribute("class","img_border_active");
	objThumb.setAttribute("className","img_border_active");

	if(prev_img!="" && prev_img!=imgId)
	{
		objPrev		=	document.getElementById("thumb"+prev_img);
		objPrev.setAttribute("class","img_border_80");
		objPrev.setAttribute("className","img_border_80");
	}
	prev_img = imgId;
}

function showToolTips1(id,alink,xpos,ypos)
{
 var obj = document.getElementById(id);
 var cord = getAnchorPosition(alink);
 cord.y = cord.y+ypos;
 cord.x = cord.x+xpos;
 obj.style.top = eval("'"+cord.y + "px'");
 obj.style.left = eval("'"+cord.x + "px'");
 obj.style.visibility= "visible";
 obj.style.display = "block"; 
 obj.style.zIndex = "100000";
}
function hideToolTip1(id)
{
	var obj				= document.getElementById(id);
	obj.style.display	= "none"; 
}
