//BROWSER SNIFFER

function Is() {
    this.ie4 = document.all && !document.getElementById;
	this.ns4 = document.layers;
	this.ie5 = document.all && document.getElementById;
	this.ns6 = document.getElementById && !document.all;
}

var is = new Is()

if(is.ns4) {
	doc = "document";
	sty = "";
	htm = ".document"
}
else if(is.ie4 || is.ie5) {
	doc = "document.all";
	sty = ".style";
	htm = ""
}
else if(is.ns6) {
	doc = "document.getElementById(";
	sty = ").style";
	htm = ""
}

var activeMenu = 'none';

//PRELOADER
var count=0;
function preLoad() {

	logo = new Image();
	logo.src = "images/dklogoSplash.jpg";


	setTimeout("redirect();", 4000);
}

function redirect(){ 
	  window.location = "welcome.php"
}

function loadCheck() {
	count++;
	if(count==11) {
	}
}

//LAYER SETUP
function LayerSetup() {
	if(is.ns6)
	{
		mainLyr = eval(doc + '["main"]' + sty);
		mainLyr.left = 20;
		mainLyr.top = 63;
		    
		myAccountNavLyr = eval(doc + '["myAccountNav"]' + sty);
		myAccountNavLyr.left = 203;
		myAccountNavLyr.top = 65;
	}
	else
	{
		myAccountUnderlineLyr = eval(doc + '["myAccountUnderline"]' + sty);
		myAccountUnderlineLyr.left = 228;
		myAccountUnderlineLyr.top = 83;
		    
		myAccountNavLyr = eval(doc + '["myAccountNav"]' + sty);
		myAccountNavLyr.left = 223;
		myAccountNavLyr.top = 85;
	}
	//preLoad();
}

function showLayer(layer)
{
	showLyr = eval(doc + '["' + layer + '"]' + sty);
	showLyr.visibility = "visible";
}

function hideLayer(layer)
{
	hideLyr = eval(doc + '["' + layer + '"]' + sty);
	hideLyr.visibility = "hidden";
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,offset){
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	if(offset==20)
	{
		LeftPosition += 20;
		TopPosition += 20;
	}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}

function NewCertWindow(mypage,myname,w,h,scroll,offset){
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	if(offset==20)
	{
		LeftPosition += 20;
		TopPosition += 20;
	}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes';
	win=window.open(mypage,myname,settings);
}

var clipTop = 0;
//var clipWidth = 212;
var clipBottom = 305;
//var topper = 300;
var lyrheight = 0;
function prepLyr()
{
	textLyr = eval(doc + '["text"]' + sty);
	if (is.ns4)
	{
		lyrheight = textLyr.clip.bottom;
		lyrheight += 20;
		textLyr.clip.top = clipTop;
		textLyr.clip.left = 0;
		textLyr.clip.right = 500;
		textLyr.clip.bottom = clipBottom;
	}
	else
	{
		if(is.ns6)
			lyrheight = document.getElementById("text").offsetHeight;
		else
			lyrheight = text.offsetHeight;
			
		textLyr.clip = 'rect('+clipTop+' 350 '+clipBottom+' 0)'
	}
	textLyr.visibility = "visible";
}

var loop = false;
//var direction = "up";
var timer1 = null;
function scroll(dir)
{
	textLyr = eval(doc + '["text"]' + sty);
	//lyrheight = text.offsetHeight;
    direction = dir;
    speed = 1;
    var y_pos = parseInt(textLyr.top);
    //var x_pos = parseInt(textLyr.left);
	//alert(y_pos);
	if(direction == "down") 
	{
		if(clipBottom > lyrheight)
			return;
		textLyr.top = (y_pos-(speed));
		clipTop += speed;
		clipBottom  += speed;
		if (is.ns4)
		{
			textLyr.clip.top = clipTop;
			textLyr.clip.bottom = clipBottom;
			//alert(textLyr.top);
		}
		else
		{
			clipstring = 'rect('+clipTop+' 350 '+clipBottom+' 0)';
			textLyr.clip = clipstring;
		}
		clearTimeout(timer1);
		timer1 = setTimeout("scroll(direction,speed)", 2);
	} 
	else if(direction == "up") 
	{
		if(y_pos > 112)
			return;
		textLyr.top = (y_pos+(speed));
		clipTop -= speed;
		clipBottom  -= speed;
		if (is.ns4)
		{
			textLyr.clip.top = clipTop;
			textLyr.clip.bottom = clipBottom;
			//alert(textLyr.clip.top);
		}
		else
		{
			clipstring = 'rect('+clipTop+' 350 '+clipBottom+' 0)';
			textLyr.clip = clipstring;
			//textLyr.top = topper;
		}
		clearTimeout(timer1);
		timer1 = setTimeout("scroll(direction,speed)", 2);
	}
	return;
}	

function stopScroll()
{
	if (timer1) clearTimeout(timer1);
}

//Reveal image
function nowUseeMe(thisOne){
    theImage=thisOne
    reveal=setInterval("incFilter(theImage)",10)//increment time in milliseconds
                                    
}

//Return to original opacity.
//I originally faded the images back into opacity,
//but if you move the mouse over another image, 
//the fading back stops, so it must be done instantaneously
function nowUdont(thisOne){
    clearInterval(reveal)
    thisOne.filters.alpha.opacity=0
}

function incFilter(current){
    if (current.filters.alpha.opacity<100)
    current.filters.alpha.opacity+=10//amount to increment until 100%
else      clearInterval(reveal)
}
	
function selectAll() {
    var i = 0;

    while(i<document.diamonds.shape.length) {
        document.diamonds.shape[i].checked = true;
        i++;
        }
    }
