﻿
//--BEGIN SHOWWINDOW SCRIPT--
 
	var wid=400;
	var ht=300;
	var scrnwid=800;
	var scrnht=600;
	var bSizeable = 0;
	var bTools = 0;

    function getScrnCtrX(devWid){
    x = (devWid )/2, y = (ht)/2;
	if (screen) {
	    scrnwid = screen.availWidth;
	    scrnht  = screen.availHeight;
	    if( scrnwid<devWid){
	        devWid = scrnwid-16;
	        }
	    y = (scrnht - ht)/2;
	    x = (scrnwid - devWid)/2;
		}
	 if (scrnwid > 1800) {
	    x = ((scrnwid/2) - devWid)/2;
		}
    return x;
    }
    function getScrnCtrY(devWid){
    x = (devWid )/2, y = (ht)/2;
	if (screen) {
	    scrnwid = screen.availWidth;
	    scrnht  = screen.availHeight;
	    if( scrnwid<devWid){
	        devWid = scrnwid-16;
	        }
	    y = (scrnht - ht)/2;
	    x = (scrnwid - devWid)/2;
		}
	 if (scrnwid > 1800) {
	    x = ((scrnwid/2) - devWid)/2;
		}
    return y;
    }    
	function baseshowwindow(url) {
		x = (wid )/2, y = (ht)/2;
		if (screen) {
	 scrnwid = screen.availWidth;
	 scrnht  = screen.availHeight;
	 if( scrnwid<wid){
	  wid = scrnwid-16;
	  }
			y = (scrnht - ht)/2;
			x = (scrnwid - wid)/2;
		}
	 if (scrnwid > 1800) {
	 x = ((scrnwid/2) - wid)/2;
		}
	 popw = window.open(url,'MyFavoriteECards','width=' + wid + ',height=' + ht +',screenX=' + x + ',screenY='+ y + ',top=' + y 
	+ ',left=' + x + ',toolbar='+bTools+',scrollbars='+bSizeable+',resizable='+bSizeable);
	 popw.focus();
	}
	function showHelpWindow(url){
	    wid=400;
	    ht=500;
	    bSizeable = 1;
	    baseshowwindow(url);
	}
	function showwindowAtSize(url,w,h) {
    	wid=w;
	    ht=h;
	    bSizeable = 0;
	    baseshowwindow(url);
	}
	function showwindowSizeable(url,w,h) {
    	wid=w;
	    ht=h;
	    bSizeable = 1;
	    baseshowwindow(url);
	}
	function showMapWindow(url){
	    wid = 550;
	    ht = 600;
	    bSizeable = 1;
	    bTools = 1;
	    baseshowwindow(url);
	}
	function showPrintWindow(url) {
	    wid=750;
	    ht=600;
	    bSizeable = 1;
	    bTools = 1;
	    baseshowwindow(url);
	}
	function showwindow(url) {
	    baseshowwindow(url);
	}
    function showMessage(Msg){
         alert(Msg);
    }
//--END SHOWWINDOW SCRIPT--



//--BEGIN BUBBLE TOOLTIPS SCRIPT--

function enableTooltips(id){
var links,i,h;
if(!document.getElementById || !document.getElementsByTagName) return;
AddCss();
h=document.createElement("span");
h.id="btc";
h.setAttribute("id","btc");
h.style.position="absolute";
document.getElementsByTagName("body")[0].appendChild(h);
//RICK NOTE: asp outputs imagebuttons to html as "input" (like real buttons) if Image or img is used, then change here
if(id==null) links=document.getElementsByTagName("img"); //("input");
else links=document.getElementById(id).getElementsByTagName("img"); //("input");
for(i=0;i<links.length;i++){
    Prepare(links[i]);
    }
}

function Prepare(el){
var tooltip,t,b,s,l;
t=el.getAttribute("title");
//if(t==null || t.length==0) t="link:";
if(t==null || t.length<2) return;
//make sure it isnt too long or bubble will break
if(t.length > 175){
    t= t.substring(0,175);
}
el.removeAttribute("title");
tooltip=CreateEl("span","tooltip");
s=CreateEl("span","top");
s.appendChild(document.createTextNode(t));
tooltip.appendChild(s);
 
//This shows text at bottom last line its required
b=CreateEl("b","bottom");
b.appendChild(document.createTextNode(""));
tooltip.appendChild(b);
 

el.tooltip=tooltip;
el.onmouseover=showTooltip;
el.onmouseout=hideTooltip;
el.onmousemove=Locate;
}

function showTooltip(e){
document.getElementById("btc").appendChild(this.tooltip);
Locate(e);
}

function hideTooltip(e){
var d=document.getElementById("btc");
if(d.childNodes.length>0) d.removeChild(d.firstChild);
}

function CreateEl(t,c){
var x=document.createElement(t);
x.className=c;
x.style.display="block";
return(x);
}

function AddCss(){
/*
RICKNOTE: This links the style sheet originally bt.css but im using it in stdinclude.js
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","bt.css");
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
*/
}

function Locate(e){
var posx=0,posy=0;
if(e==null) e=window.event;
if(e.pageX || e.pageY){
    posx=e.pageX; posy=e.pageY;
    }
else if(e.clientX || e.clientY){
    if(document.documentElement.scrollTop){
        posx=e.clientX+document.documentElement.scrollLeft;
        posy=e.clientY+document.documentElement.scrollTop;
        }
    else{
        posx=e.clientX+document.body.scrollLeft;
        posy=e.clientY+document.body.scrollTop;
        }
    }
document.getElementById("btc").style.top=(posy+17)+"px";
document.getElementById("btc").style.left=(posx-20)+"px";
}
//--END BUBBLE TOOLTIPS SCRIPT-- 

//--BEGIN DIV WINDOWS SCRIPT--
 
// Hide the DIV by ID
function hideDiv(divID) 
{ 
    var divs = document.getElementsByTagName('div'); 
    for(i=0;i<divs.length;i++){ 
//      if(divs[i].id.match(divID))
        if(divs[i].id == divID)
        {//if they are 'see' divs 
        if (document.getElementById) // DOM3 = IE5, NS6 
            {
            divs[i].style.visibility =  'hidden';
            divs[i].style.zIndex = 0;
            }
        else if (document.layers) // Netscape 4 
                {
                document.layers[divs[i]].display = 'hidden'; 
                document.layers[divs[i]].zIndex = 0;
                }
        else // IE 4 
            {
            document.all.hideshow.divs[i].visibility = 'hidden'; 
            document.all.hideshow.divs[i].zIndex = 0;
            }
        } 
    } 
} 

// Show the DIV by ID
function showDiv(divID) 
{ 
    var divs = document.getElementsByTagName('div'); 
    for(i=0;i<divs.length;i++){ 
//      if(divs[i].id.match(divID))
        if(divs[i].id == divID)
        { 
        if (document.getElementById) 
            {
            divs[i].style.visibility="visible"; 
            divs[i].style.zIndex = 1001;
            }
        else if (document.layers) // Netscape 4 
            {
            document.layers[divs[i]].display = 'visible'; 
            document.layers[divs[i]].zIndex = 1001;
            }
        else // IE 4 
            {
            document.all.hideshow.divs[i].visibility = 'visible'; 
            document.all.hideshow.divs[i].zIndex = 1001;
            }
        } 
    } 
} 

function getScrollXY() {
    var coordinates=new Object();
    var x = 0, y = 0;
    if( typeof( window.pageYOffset ) == 'number' ) {
        // Netscape
        x = window.pageXOffset;
        y = window.pageYOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        // DOM
        x = document.body.scrollLeft;
        y = document.body.scrollTop;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        // IE6 standards compliant mode
        x = document.documentElement.scrollLeft;
        y = document.documentElement.scrollTop;
    }
    coordinates.x = x;
    coordinates.y = y;
    return coordinates;
}
function moveDivObjXY(divID,left,top)
{
  var the_style = getStyleObject(divID);
  var the_left = left;
  var the_top = top;
  if (document.layers)
  {
    the_style.left = the_left;
    the_style.top = the_top;
  }
  else 
  {
    the_style.left = the_left + "px";
    the_style.top = the_top + "px";  
  }
}
// Move the DIV to relative position offset +/- left,top !Make sure that Div has property position not relative
function moveDivObjXYToScroll(divID,left,top)
{
    var coordinates = getScrollXY();
    var left2 = left + coordinates.x;
    var top2 = top + coordinates.y;
//    alert("move:"+left+" "+top);
    moveDivObjXY(divID, left2, top2);
}
// Move the DIV to relative position offset +/- left,top !Make sure that Div has property position not relative
function moveDivObjXYRelToScroll(divID)
{
    var coordinates = getScrollXY();
    var left = coordinates.x;
    var top = coordinates.y;
//    alert("move:"+left+" "+top);
    moveDivObjXYRel(divID, left, top);
}
// Move the DIV to relative position offset +/- left,top !Make sure that Div has property position not relative
function moveDivObjXYRel(divID, left, top)
{
  var the_style = getStyleObject(divID);
  var the_left = parseInt(the_style.left) + left;
  var the_top = parseInt(the_style.top) + top;
  if (document.layers)
  {
    the_style.left = the_left;
    the_style.top = the_top;
  }
  else 
  {
    the_style.left = the_left + "px";
    the_style.top = the_top + "px";  
  }
}

// Helper function to get style object from id tag
function getStyleObject(objectId) 
{
    // cross-browser function to get an object's style object given its
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject


 //--------------------------------------------------
 //---  Hide&Show Help and Video Divs  --------------
 //--------------------------------------------------

 var flashFile = "";    
 
function setFlashDiv(divID, divFlashID, file, w, h, showIt ) {

    if(showIt == "H"){
        w=h=1;
    }    
    flashFile = file;
    var str = "";
    str += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + w + "\" height=\"" + h + "\" id=\"pr\" align=\"middle\">";
    str += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
    str += "<param name=\"movie\" value=\""+file+"\" />";
    str += "<param name=\"quality\" value=\"high\"  />";
    str += "<param name=\"wmode\" value=\"transparent\" />";
    str += "<embed src=\"" + file + "\" quality=\"high\" wmode= \"transparent\" width=\"" + w + "\" height=\"" + h + "\" name=\"pr\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
    str += "</object>";
    divFlashID.innerHTML = str;
    if(showIt == "S"){
        showDiv(divID);
        }
    else 
    if(showIt == "H"){
        hideDiv(divID);
        }
}    

function enablePgFlashDiv( divFlashID, file, vars, w, h ) {
//Use for embedded flash in webpages like home Default etc.
    var flashID = getObjectName(divFlashID);
    if(vars == "")vars="?nada=0";  //must force a null vars to something else fails!
    var str = "";
    str += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + w + "\" height=\"" + h + "\" id=\"pr\" align=\"middle\">";
    str += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
    str += "<param name=\"movie\" value="+file+" />";
    str += "<param name=\"src\" value="+file+" />";
    str += "<param name=\"quality\" value=\"high\" />";
    str += "<param name=\"wmode\" value=\"transparent\" />";
    str += "<param name=\"flashvars\" value="+vars+" />";
    str += "<embed src="+file+" flashvars="+vars+" wmode= \"transparent\" quality=\"high\"  width=\"" + w + "\" height=\"" + h + "\" name=\"pr\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
    str += "</object>";
    flashID.innerHTML = str;
 //alert(divFlashID+"<br>"+str);
}    

function getObjectName(objectId) 
{
    // cross-browser function to get an object's style object given its
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}
function getObjMatchInMasterPage(objectId, tagName) {
    var objId = null;
    var objNms = document.getElementsByTagName(tagName);
    for (i = 0; i < objNms.length; i++) {
        if (objNms[i].id.match(objectId)) {
            objId = objNms[i].id;
        }
    }
    return objId;
}
function getObjectNameASP(objId, tagName) {
    var objectId = getObjMatchInMasterPage(objId, tagName);
    // cross-browser function to get an object's style object given its
    if (document.getElementById && document.getElementById(objectId)) {
        // W3C DOM
        return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
        // MSIE 4 DOM
        return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
        // NN 4 DOM.. note: this won't find nested layers
        return document.layers[objectId];
    } else {
        return false;
    }
}
function setHelpWindowText(divID,txt){
    divID.innerHTML = txt;

} 
//--------------- End Hide Show Video and Help Divs -----------------------------


