/***********
    used by: the following [updated 2009-09-08, 2011-02-28, 2011-08-18]
#########################################################################
##  Copyright © 2011 - Delorey Consulting Group LLC                    ##
##  $Id: event.php, 2005-11-12 DCG $ [root]                            ##
##  $Id: dcg_functions_banner_top.php, 2008-04-03 DCG $ admin/includes/##
##  $Id: header.php, DCG, 2005-12-06 $ client/includes/                ##
##  Next, only used by NSAV:                                           ##
##   $Id: miele_vacuum.php, 2005-12-08 DCG $ [root]                    ##
##   $Id: sebo_vacuum.php, 2005-12-09 DCG $ [root]                     ##
##   $Id: sewing.php, 2005-11-12 DCG $ [root]                          ##
##   $Id: sewing_elna.php, 2005-11-12 DCG $ [root]                     ##
##   $Id: sewing_pfaff.php, 2005-11-12 DCG $ [root]                    ##
##   $Id: sewing_usedmachines.php, 2005-11-12 DCG $ client/            ##
##   $Id: sewing_viking.php, 2005-11-12 DCG $ [root]                   ##
##   $Id: simplicity_vacuum.php, 2005-12-09 DCG $ [root]               ##
##   $Id: vacuums.php, 2005-12-05 DCG $ [root]                         ##
##   $Id: s5_information.php, 2006-08-13 DCG $ client/miele/           ##
#########################################################################
***********/

/***********
Modified 2005-08-17
Added Viking functions
***********/

/***********
    used by: about, classes, contact, contactok, coupon, day, directions,
	location, mailing_list, month, photos_projects, photos_store, remove
	sitemap, suggestion, dcg_functions_banner_top, header [17 scripts]
#########################################################################
##  Copyright © 2010 - Delorey Consulting Group LLC - 2010-09-01       ##
##  $Id: dcg_functions_header_footer.php, 2005-12-05 DCG $ client/includes/
#########################################################################
***********/

/***********
	function openMe
***********/
winName = "";
function openMe(winName,urlPath,width,height,top,left) {
	winName = winName;
	eval(winName + '= eval(\'window.open(urlPath,"\' + winName + \'","resizable=yes,scrollbars=yes,width=\' + width + \',height=\' + height + \',top=' + top + ',left=' + left + '")\')')
	eval('window.' + winName + '.focus()');
}
/**********************/


/***********
	function detectSP2()  -- detection of compliant browser/OS
***********/	
	function detectSP2() {	
	var g_fIsSP2 = false;
  		g_fIsSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
		//alert(g_fIsSP2);
  	if (g_fIsSP2){
      //This browser is Internet Explorer in SP2. 
	  h = parseInt(h);	  
	  h = h + 22;  // the approximate height of the status bar.
	}
  	else{
      //This browser is not Internet Explorer in SP2.
	  h = parseInt(h);	  
	  h = h + 0;
	  }
	}
/***********
	function mieUWHLT()  -- for opening feature/benefit windows
***********/
function mieUWHLT(url,width,height,left,top) {
	w= width;
	h= height;		
	l = left;
	t = top;	
	spTest = detectSP2();
	myNewWin=window.open(url,"mieWindow","resizable=no,menubar=no,location=no,toolbar=no,scrollbars=no,status=no,directories=no");if(window.focus){myNewWin.focus();};	
	myNewWin.resizeTo(w,h);	
	myNewWin.moveTo(l,t);	
	myIP = "";
	theUrl = "";	
	w= "";
	h= "";
	l = "";
	t = "";
	}
/***********
     vacUWHLT(url,width,height,left,top) for opening new windows
***********/
function vacUWHLT(url,width,height,left,top) {
	w= width;
	h= height;		
	l = left;
	t = top;	
	spTest = detectSP2();
	myNewWin=window.open(url,"vacWindow","resizable=no,menubar=no,location=no,toolbar=no,scrollbars=no,status=no,directories=no");if(window.focus){myNewWin.focus();};	
	myNewWin.resizeTo(w,h);	
	myNewWin.moveTo(l,t);	
	myIP = "";
	theUrl = "";	
	w= "";
	h= "";
	l = "";
	t = "";
	}
/***********
     function steUWHLT(url,width,height,left,top) -- for steamoven.com
***********/
function steUWHLT(url,width,height,left,top) {
	w= width;
	h= height;		
	l = left;
	t = top;	
	myNewWin=window.open(url,"steWindow","resizable=no,menubar=no,location=no,toolbar=no,scrollbars=no,status=no,directories=no");if(window.focus){myNewWin.focus();};	
	myNewWin.resizeTo(w,h);	
	myNewWin.moveTo(l,t);	
	myIP = "";
	theUrl = "";	
	w= "";
	h= "";
	l = "";
	t = "";
	}
/***********
     function mvdUWHLT(url,width,height,left,top) -- MVD.COM IMAGE LIBRARY GALLERIES
***********/
function mvdUWHLT(url,width,height,left,top) {
	w= width;
	h= height;		
	l = left;
	t = top;	
	myNewWin=window.open(url,"mieWindow","resizable=no,menubar=no,location=no,toolbar=no,scrollbars=yes,status=no,directories=no");if(window.focus){myNewWin.focus();};	
	myNewWin.resizeTo(w,h);	
	myNewWin.moveTo(l,t);	
	myIP = "";
	theUrl = "";	
	w= "";
	h= "";
	l = "";
	t = "";
	}
/***********
     function mieScrollUWHLT(url,width,height,left,top) -- for opening new windows
***********/
function mieScrollUWHLT(url,width,height,left,top) {
	w= width;
	h= height;		
	l = left;
	t = top;	
	spTest = detectSP2();
	myNewWin=window.open(url,"mieScrollWindow","resizable=no,menubar=no,location=no,toolbar=no,scrollbars=yes,status=yes,directories=no");if(window.focus){myNewWin.focus();};	
	myNewWin.resizeTo(w,h);	
	myNewWin.moveTo(l,t);	
	myIP = "";
	theUrl = "";	
	w= "";
	h= "";
	l = "";
	t = "";
	}
/***********
     function fullUWHLT(url,width,height,left,top) -- for opening new windows
***********/
function fullUWHLT(url,width,height,left,top) {
	w= width;
	h= height;		
	l = left;
	t = top;	
	myNewWin=window.open(url,"fullWindow","resizable=yes,menubar=no,location=no,toolbar=no,scrollbars=yes,status=yes,directories=no,fullscreen=no");if(window.focus){myNewWin.focus();};	
	myNewWin.resizeTo(w,h);	
	myNewWin.moveTo(l,t);	
	myIP = "";
	theUrl = "";	
	w= "";
	h= "";
	l = "";
	t = "";
	}
/***********
     function imageUWHLT(url,width,height,left,top) -- for opening new windows
***********/
function imageUWHLT(url,width,height,left,top) {
	w= width;
	h= height;		
	l = left;
	t = top;	
	myNewWin=window.open(url,"imageWindow","resizable=yes,menubar=no,location=no,toolbar=no,scrollbars=yes,status=no,directories=no,fullscreen=no");if(window.focus){myNewWin.focus();};	
	myNewWin.resizeTo(w,h);	
	myNewWin.moveTo(l,t);	
	myIP = "";
	theUrl = "";	
	w= "";
	h= "";
	l = "";
	t = "";
	}
/***********
     function openWindowAllPropertiesOn(url,width,height,left,top) -- for opening new windows
***********/
function openWindowAllPropertiesOn(url,width,height,left,top) {
	w= width;
	h= height;		
	l = left;
	t = top;	
	spTest = detectSP2();
	myNewWin=window.open(url,"allPropertiesOnWindow","resizable=yes,menubar=yes,location=yes,toolbar=yes,scrollbars=yes,status=yes,directories=yes");if(window.focus){myNewWin.focus();};	
	myNewWin.resizeTo(w,h);	
	myNewWin.moveTo(l,t);	
	myIP = "";
	theUrl = "";	
	w= "";
	h= "";
	l = "";
	t = "";
	}
/***********
	function right(e) - Sebo - Miele
***********/
function right(e) {
  if(document.all)
    if(event.button == 2)
	  return false;
	if(document.layers)
	  if(e.which == 3)
	     return false;
}
/***********
	function right2(e) - Sebo - Miele
***********/
function right2(e) {
  event.returnvalue=false;
  return false;
}
/***********
	function trap() - Sebo - Miele
***********/
function trap() 
  {
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
	  document.images[i].oncontextmenu = right2;
      }
    }
  }
/***********
	function popWin()  -- for opening Horn pop-up windows
***********/
	function popWin(pwin)
	{
		window.open(pwin, 'popWin', 'width=650, height=650, toolbars=no, scrollbars=no');
	}
/***********
	function Pop()  -- for opening Sebo and Horn pop-up windows
***********/
	function Pop(theURL,winName,features) 
	{ //v1.2
		window.open(theURL,winName,features);
	}
/******************************************************************
	functions for Viking
******************************************************************/
// javascript-request-object 
// Programmed 2002-08-20 by Richard Appelgren (c) 
// version 1.0 
/***********
	function request.querystring - Viking
***********/
var request = new Object();
request.querystring = function(skey) { 
    var val="", qs, arr = [], nr, key = skey+"="; 
    if(window.location.href.indexOf("?")>-1) { 
        qs = window.location.href.substring(window.location.href.indexOf("?")+1); 
        arr = qs.split("&"); 
        for(var i=0;i<arr.length;i++) { 
            nr = arr[i].lastIndexOf(key); 
            if(nr>-1) { 
                val = arr[i].substring(nr+key.length); 
                break; 
            } 
        } 
    } 
    return val; 
} 
//var theValue = request.querystring("test2")); 
/***********
	function zooma.openWin - Viking
	zooma -object [original comment]
***********/
var zooma = new Object(); 
zooma.openWin = function(url, name, prop) {
    name = (name==null || (name==''))?'PopupWindow':name;
    window.open(url, name, prop);
}
/***********
	function zooma.openMediaWindow - Viking
***********/
zooma.openMediaWindow = function(url) {
    zooma.openWin(url,'MediaWindowFlash','width=1,height=1,scrollbars=yes,resizable=no,left=100,top=100');
}
/***********
	function zooma.openTextWindow - Viking
***********/
zooma.openTextWindow = function(url) {
    zooma.openWin(url,'TextWindow','resizable=yes,scrollbars=yes,location=no,menubar=no,status=yes,top=1,left=1,width=650,height=530');
}
/***********
	function zooma.setMediaWindow - Viking
***********/
zooma.setMediaWindow = function() {
	/*------------------------------------------------
	resizes the window and layers, to make
	the media appear in the middle with some margin
	------------------------------------------------*/
    var pageMarginWidth=100, pageMarginHeight=100;
    var contentMarginWidth=10, contentMarginHeight=10;
    var frm = document.getElementById("frmMediaProperties");
    var w = parseInt(frm.width.value);
    var h = parseInt(frm.height.value);
    window.resizeTo(w+pageMarginWidth, h+pageMarginHeight);
    var pageLayer = document.getElementById("pagemedia");
    pageLayer.style.width = w+contentMarginWidth+"px";
    window.focus();
}
/***********
	function zooma.gotoSelectUrl - Viking
***********/
zooma.gotoSelectUrl = function(sel) {
    var url = sel.options[sel.options.selectedIndex].value;
    url = (url=='' || (url==null))?'':url;
    if(url!='') {
        window.location.href = sel.options[sel.options.selectedIndex].value;
    }
}
/***********
	function zooma.changePage - Viking
***********/
zooma.changePage = function(id, inc) {
    var sel = document.getElementById(id);
    var currentindex=-1;
    for(currentindex=0;currentindex<sel.options.length;currentindex++) {
        if(sel.options[currentindex].value==zooma.currentPageName) {break;}
    }
    // check if this page is the last or first ...
    if((currentindex==-1) || (inc==1 && (currentindex==sel.options.length-1)) || (inc==-1 && (currentindex==0))) {return;}
    if(sel.options[currentindex+inc].value==null || (sel.options[currentindex+inc].value=='')) {return;}
    
    window.location.href = sel.options[currentindex+inc].value;
}
/**********************/

/***********
    used by: NOT USED - un-comment "document.write()" to generate output
#########################################################################
##  Copyright © 2010 - Delorey Consulting Group LLC - 2010-09-01       ##
##  $Id: password.php, 2004-10-26 DCG $ admin/includes/                ##
#########################################################################
***********/

/***********
	function gettoday [example output: "Sunday, February 08, 2009" ]
***********/
var temp=new Date()
var year=temp.getYear()
 if (year < 1000) year+=1900
var day=temp.getDay()
var month=temp.getMonth()
var daym=temp.getDate()
 if (daym<10) daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
/*document.write(dayarray[day]+", "+montharray[month]+" "+daym+", "+year)*/
/**********/

// JavaScript Document
/***********
	function openwindow
***********/
winName = "";
 function openwindow(winName,urlPath,width,height,top,left) {
 winName = winName;
 eval(winName + '= eval(\'window.open(urlPath,"\' + winName + \'","resizable=<?php echo $perm; ?>,scrollbars=<?php echo $perm; ?>,width=\' + width + \',height=\' + height + \',top=' + top + ',left=' + left + '")\')')
 eval('window.' + winName + '.focus()');
 }
/**********************/
