﻿// JScript File
var _skin;
var loc1 = location.href;
if(loc1.indexOf("www") > 0)
    _skin="http://www.kormancommunities.com/ave/common/flash/SteelOverAll.swf";
else
    _skin="http://kormancommunities.com/ave/common/flash/SteelOverAll.swf";
    
    
var objLogo;
var objLogoPos;

var twLogo;
var twLogoAlpha;

var objHeader;
var oldColor = "07A9EC";
var twP, twC, twS;


//Image Over
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];}
}


//Thumbs
var imageIndex=1;
var toggle=true;
var timerID = 0;

function loadPhoto(path){
    var photoHolder = document.getElementById("mainPhoto");
    if(document.getElementById('img_1')==null){
        var img = (document.getElementById("overViewPhoto")==null) ? path : document.getElementById("overViewPhoto").src;
        var str = "";
		str += (navigator.appVersion.indexOf("MSIE")!=-1) ? "<div>" : "<div style='margin-left:0px;'>" ; 
		str += "<div style=\"position:absolute;z-index:1\" id=\"div1\"><img id=\"img_1\" src=\"\" style='filter:Alpha(opacity=100);'/></div>";
	    str += "<div style=\"position:absolute;z-index:2\" id=\"div2\"><img id=\"img_2\" src=\""+img+"\" style='filter:Alpha(opacity=100);'/></div>";
		str += "</div>";
        photoHolder.innerHTML = str;
    }
    popNextImage(path);
}

function nextImage(){
    if(toggle){
	    opacityTween = new OpacityTween(document.getElementById('img_1'),Tween.regularEaseOut, 100, 0, 1);
	    opacityTween2 = new OpacityTween(document.getElementById('img_2'),Tween.regularEaseOut, 0, 100, 1);
    }else{
    
	    opacityTween = new OpacityTween(document.getElementById('img_2'),Tween.regularEaseOut, 100, 0, 1);	
	    opacityTween2 = new OpacityTween(document.getElementById('img_1'),Tween.regularEaseOut, 0, 100, 1);
    }
    opacityTween.start();
    opacityTween2.start();
}

function popNextImage(path){
    var d = document.getElementById("div1");
    var img;
    if(toggle){
	    img = document.getElementById("img_1");
	    d.style.zIndex = "3";
	    toggle=false;	
    }else{
	    img = document.getElementById("img_2");
	    d.style.zIndex = "0";
	    toggle=true;
    }
	
    img.src = path;	
    img.style['opacity'] = 0;
    img.style['-moz-opacity'] = 0;
    img.onload = function(){
        nextImage();
        imageIndex=2;
        //timerID  = setTimeout("nextImage()", 1000);
    }
    if(img.filters) img.filters.alpha['opacity'] = 0;	
}


//Home Slide Show
var nArr = new Array("ss1.jpg","ss2.jpg","ss3.jpg","ss4.jpg","ss5.jpg","ss6.jpg","ss7.jpg","ss8.jpg","ss9.jpg");
var imgPath = "images/slideshow/";   

    
    function nextImageH(){
        clearTimeout(timerID);
        timerID  = 0;
    
	    document.getElementById("mainPhoto").style.cursor="wait";
	    document.getElementById("mainPhoto").onclick=null;
	    if(toggle){
		    opacityTween = new OpacityTween(document.getElementById('img_1'),Tween.regularEaseOut, 100, 0, 1);
	    }else{
		    opacityTween = new OpacityTween(document.getElementById('img_2'),Tween.regularEaseOut, 100, 0, 1);	
	    }
	    opacityTween.onMotionFinished = function(){popNextImageH()};
	    opacityTween.start();
	    imageIndex++;
    	
	    if(imageIndex>=nArr.length)imageIndex=0;	
    }

    function popNextImageH(){
	    document.getElementById("mainPhoto").style.cursor="pointer";
	    document.getElementById("mainPhoto").onclick=nextImageH;
	    var d = document.getElementById("div1");
	    var img;
	    if(toggle){
		    img = document.getElementById("img_1");
		    d.style.zIndex = "0";
		    toggle=false;	
	    }else{
		    img = document.getElementById("img_2");
		    d.style.zIndex = "2";
		    toggle=true;
	    }
    	
	    img.src = imgPath+nArr[imageIndex];	
	    img.style['opacity'] = 100;
	    img.style['-moz-opacity'] = 100;
	    img.onload = function(){
	        timerID  = setTimeout("nextImageH()", 4000);
	    }
	    if(img.filters) img.filters.alpha['opacity'] = 100;	
    }
  
    
    function newWindow(url, height, width) 
	{
		nameW='rules'
		if (navigator.appVersion.indexOf('4') != -1) {
			// Vars for centering the new window on Version 4 Browsers
			xTop = screen.width/2 - (width/2);
			yTop = screen.height/2 - (height/2);
			window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');
		} 
		else {
			window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
		}
	}