﻿
// Detect client browser:
// Code origin: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html

var agt=navigator.userAgent.toLowerCase();

var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
			&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
			&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) ||
					  (agt.indexOf("; nav") != -1)) );
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_gecko = (agt.indexOf('gecko') != -1);

var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3 = (is_ie && (is_major < 4));
var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up = (is_ie && (is_major >= 4));
var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

var is_opera = (agt.indexOf("opera") != -1);
var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
var is_opera7 = (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1);
var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
var is_opera6up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5);
var is_opera7up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5 && !is_opera6);

var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
var is_win16 = ((agt.indexOf("win16")!=-1) || 
           (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
           (agt.indexOf("windows 16-bit")!=-1) );  
var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                (agt.indexOf("windows 16-bit")!=-1));
var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));
var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
var is_win32 = (is_win95 || is_winnt || is_win98 || 
                ((is_major >= 4) && (navigator.platform == "Win32")) ||
                (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
var is_os2   = ((agt.indexOf("os/2")!=-1) || 
                (navigator.appVersion.indexOf("OS/2")!=-1) ||   
                (agt.indexOf("ibm-webexplorer")!=-1));
var is_mac    = (agt.indexOf("mac")!=-1);
if (is_mac && is_ie5up) is_js = 1.4;
var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
                           (agt.indexOf("68000")!=-1)));
var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
                            (agt.indexOf("powerpc")!=-1)));




// Primary functions
function setvalue(objId, value){document.getElementById(objId).value=value;}
function setsrc(objId, value){document.getElementById(objId).src=value;}
function setHTML(objId, value){document.getElementById(objId).innerHTML=value;}
function setHREF(objId, value){document.getElementById(objId).href=value;}

// For enter postbacks
function tBTN2(btnID,e)
{
	var btn = document.getElementById(btnID);
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
		
	if (code == 13)
	{
	if(window.event){
	e.returnValue=false;
	e.cancelBubble = true;
	}
	else
	{
		e.preventDefault();
	}
	btn.click();
    }
}

// Positioning
function getImageXfromLeft(img) { 
  //if not using IE 
  if (!is_ie) return img.x; 
  else return getRealLeft(img);//else, using Internet explorer 
} 
function getImageYfromTop(img) { 
  if (!is_ie) return img.y; 
  else return getRealTop(img); 
} 

// Positioning IE-FIX
function getRealLeft(imgElem) { 
    xPos = imgElem.offsetLeft; 
    tempEl = imgElem.offsetParent; 
    while (tempEl != null) { xPos += tempEl.offsetLeft; tempEl = tempEl.offsetParent; } 
    return xPos; 
} 

function getRealTop(imgElem) {// 
    yPos = imgElem.offsetTop; 
    tempEl = imgElem.offsetParent; 
    while (tempEl != null) { yPos += tempEl.offsetTop; tempEl = tempEl.offsetParent; } 
    return yPos; 
} 

var cmDelay
var cmDelay2
var imgnxt
var nxttxt

function ottxt(img,txt){
imgnxt=img
nxttxt=txt
    if(cmDelay){clearTimeout(cmDelay);tvHide();
    cmDelay = setTimeout("ottxt2()", 300); 
    }else{ottxt2();}
}

function ottxt2(){

var img = imgnxt
var txt = nxttxt
var tvholder = document.getElementById("tvin"); // Inside tv
tvholder.innerHTML = txt;
var t = document.getElementById("tview");

var targetX=getImageXfromLeft(img)  + 45; 
    var targetY=getImageYfromTop(img) - 40; 
       
   if (getImageXfromLeft(img) > 800)
    targetX=getImageXfromLeft(img) -340;

    t.style.top = targetY +'px';
    t.style.left = targetX +'px';
    t.style.width = 320 +'px';

    t.style.visibility = "visible";

}


function ot(img){
imgnxt=img
    if(cmDelay){clearTimeout(cmDelay);tvHide();
    cmDelay = setTimeout("tvShow()", 300); 
    }else{tvShow();}
}
function cm(){
cmDelay = setTimeout("tvHide()", 500); 
}

function tvShow()
{
var img = imgnxt

var tvholder = document.getElementById("tvin"); // Inside tv
tvholder.innerHTML = "";
var tv = document.createElement("IMG");

if (img.getAttribute("altimg")!=null){
	tv.src=img.getAttribute("altimg");
	}else{tv.src = img.src;}

tvholder.appendChild(tv);
img.onmouseout = cm;

tv.onload = function() {
this.onload = null;
}

    var w
    if (tv.getAttribute("width") && tv.getAttribute("width") > 0)
	w = tv.getAttribute("width");
	else if (document.defaultView.getComputedStyle)
	w = parseInt(document.defaultView.getComputedStyle(tv, '').getPropertyValue("width"));
	
	
	
	var h
	if (tv.getAttribute("height") && tv.getAttribute("height") > 0)
	h = tv.getAttribute("height");
	else if (document.defaultView.getComputedStyle)
	h = parseInt(document.defaultView.getComputedStyle(tv, '').getPropertyValue("height"));


	if (w > 420)
	{
	h = ((420/w)* h);
	w = 420;
	tv.style.width='420px';
	tv.style.height= h + 'px';
	}
	

    var wi =20
    if (img.getAttribute("width") && img.getAttribute("width") > 0)
	wi = img.getAttribute("width");


    var t = document.getElementById("tview");
    var targetX=getImageXfromLeft(img) + wi + 15; 
    var targetY=getImageYfromTop(img) - (h/2) -30; 
    
   
   if (getImageXfromLeft(img) > 800)
    targetX=(getImageXfromLeft(img) - w) - 35;

    t.style.top = targetY +'px';
    t.style.left = targetX +'px';


    if (is_ie5_5up && is_win32)
            {
               t.style.filter="blendTrans(Duration=" + (is_ie6up ? "0.3" : "1") + ")";
                t.filters.blendTrans.apply();
                t.style.visibility = "visible";
    	        t.filters.blendTrans.play(); 
            }
            else
            {
                t.style.visibility = "visible";
            }
        
   
}



function tvHide()
{
var t = document.getElementById("tview");
if (is_ie5_5up && is_win32)
    {
        t.style.filter="blendTrans(Duration=" + (is_ie6up ? "0.3" : "1") + ")";
	    t.filters.blendTrans.apply();
	    t.style.visibility = "hidden";
	    t.filters.blendTrans.play();
    }
    else
    {
        t.style.visibility = "hidden";
    }
}





function bak_ot(im){
	
	t.innerHTML = "";t.style.visibility = "hidden";
	t.style.display = "inline";
 	var tv = document.createElement("IMG");
	tv.src = im.src;
	if (im.getAttribute("zoomed")!=null){
	tv.src = im.src;
	im.src=im.getAttribute("zoomed");
	}
	
	var pos = getElementPosition(im);
	
	var w
	if (tv.getAttribute("width") && tv.getAttribute("width") > 0)
	w = tv.getAttribute("width");
	else if (document.defaultView.getComputedStyle)
	w = parseInt(document.defaultView.getComputedStyle(tv, '').getPropertyValue("width"));
	
	var h
	if (tv.getAttribute("height") && tv.getAttribute("height") > 0)
	h = tv.getAttribute("height");
	else if (document.defaultView.getComputedStyle)
	h = parseInt(document.defaultView.getComputedStyle(tv, '').getPropertyValue("height"));

if (w > 480){w = w/2;h = h/2;}
else
{

}
	tv.style.width=w + "px";
	tv.style.height=h + "px";
	t.style.height=h + "px";
	t.style.top = pos.y - 100;
	
	if (pos.x > 500)
	{
	t.style.left = (pos.x - w)-40;
	}
	else
	{
		t.style.left = (pos.x + 95) + "px";
	}

 
	if (is_ie5_5up && is_win32)
        {
           t.style.filter="blendTrans(Duration=" + (is_ie6up ? "0.3" : "1") + ")";
            t.filters.blendTrans.apply();
            t.style.visibility = "visible";
    	    t.filters.blendTrans.play(); 
        }
        else
        {
            t.style.visibility = "visible";
        }
	im.onmouseout = cm;
	t.appendChild(tv);    	
}

function bak_cm(){
	var t = document.getElementById("tview");
	if (t != null) {
            if (is_ie5_5up && is_win32)
            {
            t.style.filter="blendTrans(Duration=" + (is_ie6up ? "0.3" : "1") + ")";
     		t.filters.blendTrans.apply();
      		t.style.visibility = "hidden";
      		t.filters.blendTrans.play();
            }
            else
            {
                t.style.visibility = "hidden";
            }

}
}




function vList(flag, id)
{
var fd=document.getElementById(id);
    if (flag)
    {
        if (is_ie5_5up && is_win32)
        {
        fd.style.filter="revealTrans(Duration=0.3 transition=5)";
        fd.filters[0].apply();
        fd.style.visibility = "visible";
        fd.filters[0].play(); 
        }
    else
        {
        fd.style.visibility = "visible";
        }
    }
    else
    {
    if (is_ie5_5up && is_win32)
    {
    fd.style.filter="blendTrans(Duration=" + (is_ie6up ? "0.2" : "1") + ")";
    fd.filters.blendTrans.apply();
    fd.style.visibility = "hidden";
    fd.filters.blendTrans.play();
    }
    else
    {
    fd.style.visibility = flag ? "hidden" : "visible";
    fd.style.visibility = flag ? "visible" : "hidden";
    }
    }
}


function notice(desc)
{
alert(desc)
}

