﻿// JScript File

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
var swidth=200;
var sheight=280;
var sbcolor="#ccffcc";

var sspeed=2;
var restart=1;
var rspeed=sspeed;

function goup()
{
	if(sspeed!=rspeed*8)
	{
		sspeed=sspeed*2;
		restart=sspeed;
	}
}
function start()
{
	if(document.getElementById)
	{
		ns6marquee(document.getElementById('slider'));
		}
	else if(document.all)
		{
		iemarquee(slider);
		}
	else if(document.layers)
		{
		ns4marquee(document.slider1.document.slider2);
		}
}
function iemarquee(whichdiv) 
{
    if (null != whichdiv) {
        iediv = eval(whichdiv);
        iediv.style.pixelTop = sheight;
        sizeup = iediv.offsetHeight;
        ieslide();
    }
}
function ieslide()
{
	if(iediv.style.pixelTop>=sizeup*(-1))
	{
		iediv.style.pixelTop-=sspeed;
		setTimeout("ieslide()",100);
	}
	else
	{
		iediv.style.pixelTop=sheight;
		ieslide();
	}
}
function ns4marquee(whichlayer)
{
	ns4layer=eval(whichlayer);
	ns4layer.top=sheight;
	ns4layer.document.close();
	sizeup=ns4layer.document.height;
	ns4slide();
}
function ns4slide()	
{
	if(ns4layer.top>=sizeup*(-1))
	{
		ns4layer.top-=sspeed;
		setTimeout("ns4slide()",100);
	}
	else
	{
		ns4layer.top=sheight;
		ns4slide();
	}
}
function ns6marquee(whichdiv) {
    if ( whichdiv)
    {
        ns6div = eval(whichdiv);
        ns6div.style.top = sheight + 'px';
        sizeup = ns6div.offsetHeight;
        ns6slide();
    }
}

function ns6slide(){
if(parseInt(ns6div.style.top)>=sizeup*(-1)){
ns6div.style.top=parseInt(ns6div.style.top)-sspeed + 'px';
setTimeout("ns6slide()",100);
}
else{
ns6div.style.top=sheight +'px';
ns6slide();
}
}


function ShowHideTxtDiv()
{
    var div = document.getElementById("hideTxtDiv");
    if (div.style.display == "none")
    {
        div.style.display="";
    }
    else
    {
        div.style.display = "none";
    }
}
function ShowHideContentDiv(divId)
{
 var div = document.getElementById(divId);
    if (div.style.display == "none")
    {
        div.style.display="";
    }
    else
    {
        div.style.display = "none";
    }
}

img_width = 545; 
timer = null;
 
function imageShrink() {
    growImg = document.getElementById('imageResize').style
 
    growImg.width= img_width;
 
    if(img_width >= 200) {
        img_width -= 10;
        timer = setTimeout('imageShrink()', 1);
    } else {
        clearTimeout('timer');
        img_width=545;
    }
}
img_width2=195;
timer2 = null;
function imageGrow() {
    growImg = document.getElementById('imageResize').style
    growImg.width= img_width2;
    if(img_width2 < 545) {
        img_width2 += 10;
        timer2 = setTimeout('imageGrow()', 1);
    } else {
        clearTimeout('timer2');
        img_width2=195;
    }
}

function shrinkGrowImg()
{
    Img = document.getElementById('imageResize').style
    if (Img.width == "545px")
    {
        imageShrink();
    }
    else{
        imageGrow();
    }
}
var buttonId;
function menuBntGrow(bntId)
{
    buttonId = bntId;
    growImg = document.getElementById(bntId);
    if (growImg.height < 24)
    {
        growImg.height +=2;
        timer=setTimeout('menuBntGrow(buttonId)',1);
    }
    else
    {
    clearTimeout('timer');
    }
}
timer2 = null;
var s_buttonId;
function menuBntShrink(bntId)
{
    s_buttonId = bntId;
    growImg = document.getElementById(bntId);
    if (growImg.height >= 21)
    {
        growImg.height -=2;
        timer2=setTimeout('menuBntShrink(s_buttonId)',1);
    }
    else
    {
    clearTimeout('timer2');
    //s_buttonId ="";
    }
}      


function changePic(albumName,lang)
{
	if (photoAlbum[albumName+lang] != null)
	{
		var picTotal = photoAlbum[albumName+lang].length;
		
		for (var i=1; i<= picTotal; i++)
		{
			document.getElementById("td" + i).innerHTML = "<img src='http://www.gloryharvestgroup.com/images/album/" + albumName + "/thumb/" + i + ".jpg' class='thumbImg' onclick='window.open(\"AlbumPic.html?lang=" + lang + "&album=" + albumName + "&thumbNo=" + i + "&thumbTot=" + picTotal + "\",\"\",\"menubar=0,resizable=0,location=0,status=0,width=700,height=600\")' />";
		}
	}
}
function getURLParam(strParamName){
 var strReturn = "";
 var strHref = window.location.href;
 if ( strHref.indexOf("?") > -1 ){
   var strQueryString = strHref.substr(strHref.indexOf("?"));
   var aQueryString = strQueryString.split("&");
   for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
   {
     if (aQueryString[iParam].indexOf(strParamName + "=") > -1 )
	 {
       var aParam = aQueryString[iParam].split("=");
       strReturn = aParam[1];
       break;
     }
   }
 }
 return strReturn;
}
function getPic()
{
	
    if (getURLParam("thumbTot") != null)
	{
		var picTotal = getURLParam("thumbTot");
		var albumName = getURLParam("album");
		var thumb_no = getURLParam("thumbNo");
		var lang = getURLParam("lang");
		if (photoAlbum[albumName+lang][thumb_no-1] == "Video")
		{
			var movieCode = "";
			document.getElementById("mainPicCell").innerHTML = movieCode;
		}
		else
		{
			document.getElementById("mainPic").src="http://www.gloryharvestgroup.com/images/album/" + albumName + "/" + thumb_no + ".jpg";
		}
	}
	setButton(albumName,picTotal,thumb_no,lang);
}
function setButton(albumName, total, num, lang)
{
	var addSep = false;
    var cell = document.getElementById("3ButCell");
	var htmlString = "";
	//previous button
    if(num > 1)
    {
        var nm = num -1;
        htmlString +="<a href=\"javascript:reSetButton('" + albumName + "'," + total + "," + nm + ",'" + lang + "')\"><img src='http://www.gloryharvestgroup.com/images/album/button/previous" + lang + ".gif' onmouseover='this.src=\"http://www.gloryharvestgroup.com/images/album/button/previous" + lang + "_over.gif\"' onmouseout='this.src=\"http://www.gloryharvestgroup.com/images/album/button/previous" + lang + ".gif\"' class='albumBnt' /></a>&nbsp;";
		addSep = true;
    }
	//next button
    if (num < total)
    {
		if (addSep)
		{
			htmlString += "&nbsp;&nbsp;";
		}
        var np = num-1+1+1 ;
        htmlString +="<a href=\"javascript:reSetButton('" + albumName + "'," + total + "," + np + ",'" + lang + "')\"><img src='http://www.gloryharvestgroup.com/images/album/button/next" + lang + ".gif' onmouseover='this.src=\"http://www.gloryharvestgroup.com/images/album/button/next" + lang + "_over.gif\"' onmouseout='this.src=\"http://www.gloryharvestgroup.com/images/album/button/next" + lang + ".gif\"' class='albumBnt' /></a>&nbsp;";
		
    }
	htmlString +="&nbsp;<a href='javascript:window.close()'><img src='http://www.gloryharvestgroup.com/images/album/button/close" + lang + ".gif' onmouseover='this.src=\"http://www.gloryharvestgroup.com/images/album/button/close" + lang + "_over.gif\"' onmouseout='this.src=\"http://www.gloryharvestgroup.com/images/album/button/close" + lang + ".gif\"' class='albumBnt' /></a>";
	htmlString = "<span align='right'>" + htmlString + "</span>";
	cell.innerHTML = htmlString;
	setDescription(albumName,num,lang);
}
function reSetButton(albumName, total, num,lang)
{
	var addSep = false;
    document.getElementById("mainPic").src="http://www.gloryharvestgroup.com/images/album/" + albumName + "/" + num + ".jpg";
    var cell = document.getElementById("3ButCell");
    cell.innerHTML="";
	var htmlString = "";
	//previous button
    if(num > 1)
    {
         var nm = num -1;
        htmlString +="<a href=\"javascript:reSetButton('" + albumName + "'," + total + "," + nm + ",'" + lang + "')\"><img src='http://www.gloryharvestgroup.com/images/album/button/previous" + lang + ".gif' onmouseover='this.src=\"http://www.gloryharvestgroup.com/images/album/button/previous" + lang + "_over.gif\"' onmouseout='this.src=\"http://www.gloryharvestgroup.com/images/album/button/previous" + lang + ".gif\"' class='albumBnt' /></a>&nbsp;";
		addSep = true;
    }
	//next button
    if (num < total)
    {
		if (addSep)
		{
			htmlString += "&nbsp;&nbsp;";
		}
        var np = num -1+1+1;
        htmlString +="<a href=\"javascript:reSetButton('" + albumName + "'," + total + "," + np + ",'" + lang + "')\"><img src='http://www.gloryharvestgroup.com/images/album/button/next" + lang + ".gif' onmouseover='this.src=\"http://www.gloryharvestgroup.com/images/album/button/next" + lang + "_over.gif\"' onmouseout='this.src=\"http://www.gloryharvestgroup.com/images/album/button/next" + lang + ".gif\"' class='albumBnt' /></a>&nbsp;";
    }
	htmlString +="&nbsp;<a href='javascript:window.close()'><img src='http://www.gloryharvestgroup.com/images/album/button/close" + lang + ".gif' onmouseover='this.src=\"http://www.gloryharvestgroup.com/images/album/button/close" + lang + "_over.gif\"' onmouseout='this.src=\"http://www.gloryharvestgroup.com/images/album/button/close" + lang + ".gif\"' class='albumBnt' /></a>";
	htmlString = "<span align='right'>" + htmlString + "</span>";
	cell.innerHTML = htmlString;
	setDescription(albumName,num,lang);
}
        
function setDescription(albumName,picNo,lang)
{
    var cell = document.getElementById("desc");
    cell.innerHTML = photoAlbum[albumName+lang][picNo-1];
}

function returnPath(obj)
{
    var albumName = obj;
    var path ="";
    path = "ClientThumb.html?client=" + albumName + "&thumbTot=" + photoAlbum[albumName].length;
    window.location = path;
}

function expandStrinkImg(obj)
{
    if(obj.style.width='545')
    {
        obj.style.width='250';
    }
    else
    {
        obj.style.width='545';
    }
}
function pauseFlash() 
{ 
document.getElementById("mFlash").stop();
} 
function playFlash()
{
document.getElementById("mFlash").play();
}