// -----------------------------------------------------------------------------
//    POPUP WINDOW -- WITH FEATURES
// -----------------------------------------------------------------------------

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// Sample action code
// -----------------------------------------------------------------------------
// <a href="javascript:;" onMouseDown="MM_openBrWindow('page.htm','Name','width=350,height=375')">here</a>
// <a href="javascript:;" onMouseDown="MM_openBrWindow('page.htm','Name','width=350,height=375','location=no,toolbar=no,scrollbars=no')">here</a>
// <a onmousedown="MM_openBrWindow('page.htm','Name','width=500,height=500')" href="javascript:;">here</a>

// Sample with window close feature
// <a onmousedown="MM_openBrWindow('page.htm','Win','location=yes,toolbar=yes,scrollbars=yes')" href="javascript:OnClick=window.close()">here</a>





// -----------------------------------------------------------------------------
//    POPUP WINDOW -- PRESET SIZE
// -----------------------------------------------------------------------------

	function openWeb(URL) {
	aWindow = window.open(URL,"thewindow","width=650,height=550,resize=no,scrollbars=yes");
	}


// Sample action code
// -----------------------------------------------------------------------------
// <a href="javascript:openWeb('safe_plumber.html');">





// -----------------------------------------------------------------------------
//    POPUP WINDOW -- PRESET SIZE 2
// -----------------------------------------------------------------------------

	function openWindow(title) {
		if(title=="newUser"){
			window.open('register_welcome.asp','_blank','width=250,height=375,toolbar=false,resizable=false,menubar=false,scrollbars=false,status=false');
		}
		
		if(title=="announcement"){
			window.open('announcement_popup.asp','_blank','width=200,height=150,toolbar=false,resizable=false,menubar=false,scrollbars=true,status=false');
		}
		if(title=="kc"){
			window.open('http://www.kristofcreative.com','_blank','width=200,height=150,toolbar=false,resizable=false,menubar=false,scrollbars=true,status=false');
		}
	}

// Sample action code
// -----------------------------------------------------------------------------
// <a href="javascript:openWindow('kc');">test link</a>





// -----------------------------------------------------------------------------
//    POPUP ** HTML ** WINDOW :: CENTER ON SCREEN  // Shedix.com - VotePro
// -----------------------------------------------------------------------------


function Cwinpopup(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
	var allw = screen.availWidth||screen.width;
	var allh = screen.availHeight||screen.height;
	var wint = (screen.height - height) / 2;
	var winl = (screen.width - width) / 2;
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	var _opened = window.open(url, name, 'left='+winl+',top='+wint+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
	if(_opened.window.focus) {
		_opened.window.focus();
	}
}

// Sample action code
// -----------------------------------------------------------------------------
// <a href="javascript:;" onClick="javascript:Cwinpopup('name', '#link', 0, 0, 300, 150, 0, 0, 1, 1, 1); return false;"></a>





// -----------------------------------------------------------------------------
//    POPUP ** HTML ** WINDOW :: CENTER ON SCREEN
// -----------------------------------------------------------------------------


function popup(loc, name, width, height,scroll) {
		IE = navigator.appName=="Microsoft Internet Explorer";
		NS = navigator.appName=="Netscape";
		bVer = parseInt(navigator.appVersion);

		var newWin=null;

        var _params = "width="+width+",height="+height+",scrollbars="+scroll+",'resizable=no,status=no'";

        // CENTER ON BROWSERS WHICH SUPPORT JSCRIPT 1.2
        if (bVer >= 4) {
                 _left = ( (screen.width-width) >>1 );
                 _top = ( (screen.height-height) >>1 );
        } else {
                 _left = ( (800-width) >>1 );
                 _top = ( (600-height) >>1 );
        }

        if (IE) _params += ",top=" + _top + ",left=" + _left;
        else if (NS) _params += ",screenX=" + _left + ",screenY=" + _top;

        newWin = window.open(loc, name, _params);
        if ( newWin!=null && !(IE && bVer<5) )
                newWin.focus();
}





// -----------------------------------------------------------------------------
//    POPUP ** HTML ** WINDOW :: CENTER ON SCREEN -- GrassFire.org
// -----------------------------------------------------------------------------


// <script language="Javascript">	   
   function win(newwin,opt,ht,wd) {
   var astring = ""
   var x = 0
   var y = 0
   y = screen.height * ht
   x = screen.width * wd
   if (screen.width <=640) {
      if (ht < .6) {
         y = y * 1.6;
         x = x * 1.6}
      }
   else {
      if (screen.width <=800) {
         if (ht < .6) {
         y = y * 1.29;
         x = x * 1.29}
         }   
    }           
   astring += y ;
   opt = opt + ",height=" + astring;   
   astring = ""
   astring += x;
   opt = opt + ",width=" + astring;
   NewWindow=window.open("","",opt); 
   NewWindow.location.href=newwin;
   if (NewWindow.opener == null) NewWindow.opener = window;
   }
   

// </script>

// Sample action code
// -----------------------------------------------------------------------------
// <a onMouseOut="MM_swapImgRestore()" 
// onMouseOver="MM_swapImage('gfPac','','../images/location.gif',1)" 
// href="javascript:win('../grassfirepac.htm','toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,left=250,top=200,directories=no',.25,.5)">
// <img name="gfPac" border="0" src="../images/gfpac.gif" width="98" height="20"></a>








// -----------------------------------------------------------------------------
//    POPUP ** HTML ** WINDOW :: CENTER ON SCREEN  -- (IKEA-USA.COM)
// -----------------------------------------------------------------------------


// <script type="text/javascript" language="JavaScript"> 
// <!-- 

/* ************************************
Generic JavaScript functions for opening popup windows
Created by Lars Henrik Rotnes
Last modified: 2002-10-01
************************************ */

/*
CVS Version : $Id: jsPop.js,v 1.6 2003/02/26 17:37:41 lhr Exp $

*/


/**
*Function to open a pop up window
*
*argUrl   string 	= the location of the file to open in the popup window
*argWidth string 	= the width of the window
*argHeight string = the height of the window
*argTitle string 	= the title of the window
*argScroll int  	= specify if we need scrollbars, 1 = yes, 0 = no 
*/
var is = new Object()
is.ie = (document.all) ? 1:0
is.ns4 = (document.layers) ? 1:0
is.w3c = (document.getElementById && !is.ie) ? 1:0
is.win = (navigator.userAgent.toLowerCase().indexOf("win") > 0) ? 1:0
is.mac = (navigator.userAgent.toLowerCase().indexOf("mac") > 0) ? 1:0

function openPopUp(argUrl, argWidth, argHeight, argTitle, argScroll ) {
  //for win ie, add extra width to accomodate scrollbar on pop07
 // if(is.ie && !is.mac  && argScroll=="1" && ( argTitle == "pop07" || argTitle == "pop08") ){
  //  argWidth = parseInt(argWidth) + 26;
  //}
    
	if(argScroll=="1" && !is.mac){
    argWidth = parseInt(argWidth) + 26;
  }
		if(argScroll=="1" && is.mac){
    argWidth = parseInt(argWidth) + 10;
  }
    
		
  var x = (screen.availWidth - argWidth ) / 2;
  var y = (screen.availHeight - argHeight ) / 2;
  
  var sFeatures = "width=" + argWidth + "," + 
                  "height=" + argHeight + "," + 
									"toolbar=no," + 
                  "status=no," + 
									"scrollbars=" + argScroll + "," + 
									"resizable=no," + 
                  
                  "left=" + x + ", top="+ y;
  
  window.open(argUrl, argTitle, sFeatures, false);
}
// --> 
// </script>


// Sample action code
// -----------------------------------------------------------------------------
// <a href="javascript:openPopUp('location/of/file/name.html', '500', '320', 'popup', 0)" class="Link1">Text Link to Open Window</a>






// -----------------------------------------------------------------------------
//    DYNAMIC POPUP WINDOW WITH IMAGE - CROSS PLATFORM
// -----------------------------------------------------------------------------

function image_open(image_loc,img)
{
     HTML="<html><style>body{margin:5px 0px 0px 5px}</style><body onBlur='top.close()'><img src='"+ image_loc +"' border=0 name=load_image onLoad='window.resizeTo(document.load_image.width+10,document.load_image.height+20)' alt='"+ image_loc.substr(image_loc.lastIndexOf("/")+1) +"' onClick='self.close()'></body></html>";
     popupImage=window.open('','KristofCreative_largecomp','toolbar=no,scrollbars=no,width=1,height=1');
     popupImage.document.open();
     popupImage.document.write(HTML);
     popupImage.document.close();
}

// Modified:: B=Black background

function image_openB(image_loc,img)
{
     HTML="<html><style>body{margin:5px 0px 0px 5px; background-color: #000000}</style><body onBlur='top.close()'><img src='"+ image_loc +"' border=0 name=load_image onLoad='window.resizeTo(document.load_image.width+10,document.load_image.height+20)' alt='"+ image_loc.substr(image_loc.lastIndexOf("/")+1) +"' onClick='self.close()'></body></html>";
     popupImage=window.open('','KristofCreative_largecomp','toolbar=no,scrollbars=no,width=1,height=1');
     popupImage.document.open();
     popupImage.document.write(HTML);
     popupImage.document.close();
}


// Sample action code
// -----------------------------------------------------------------------------
// <a href="#" onclick='image_openB("location/of/fullsize/image.jpg","largecomp"); return false;'><img name="zoom0" alt="Enlarge Image" height="79" width="96" src="location/of/preview/image.jpg" border="0"></a>






// -----------------------------------------------------------------------------
//    DYNAMIC POPUP WINDOW WITH IMAGE - CENTER ON SCREEN
// -----------------------------------------------------------------------------

function kcWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4  

	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("/viewimage.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
// NETSCAPE, REMOVE: onBlur="self.close()"
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="5" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Click screen to close" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}




// -----------------------------------------------------------------------------
//    CUSTOMIZED WINDOW - Center Screen -- (Buick.com)
// -----------------------------------------------------------------------------

//   customizable open window command

// r = resizable, s = scrollbars, t = toolbar, l = location, d = directories
// the order for rstld doesn't matter
// resizable default is yes, scrollbars,toolbar,location,directories defaults are no

// usage examples:

// openWindow('mylink.html,300,300,s,popWindowName'); -- pops a 300x300 window 
// with scrollbars named "popWindowName"

// openWindow('mylink.html'); -- pops a default size (hardwired to 640,400) 
// window to mylink.html

// openWindow('mylink.html',,,tlr'); -- pops a default size window to mylink.html 
// with tool and location bar that is NOT resizable
// NOTE: notice that in the example above there are two commas after the URL
// they're required in this case because we're adding the 'tlr' options
// commas without values will just pick up the default 640x400 values, or you 
// can change them to whatever. The rule is only the URL is required, but if you
// change a value downstream, then you need to fill in the values between the 
// URL and the value you're changing (even if it's only with a comma).

// It now centers the pop-up.
// -----------------------------------------------------------------------------

function openWindow(options) {

// URL,[width],[height],[rstld],[windowName]

	args=options.split(",");

	url = args[0];

	if (args.length > 1 && args[1].length > 0) {
		W=args[1]; 
	} else { 
		W=640; 
	}

	if (args.length > 2 && args[2].length > 0) {
		H=args[2]; 
	} else { 
		H=400; 
	}

	screenw = screen.availWidth;
	screenh = screen.availHeight;
	
	x = "left=" + (screenw-W)/2 + ",";
	y = "top=" + (screenh-H)/2 + ",";
	
	W = "width=" + W + ",";
	H = "height=" + H + ",";
	
	if (args.length > 3) {
		prams= args[3]; 
	} else { 
		prams="";
	}

	if (args.length > 4) {
		windowname= args[4]; 
	} else { 
		windowname="";
	}

	if (prams.indexOf('l')!=-1) { loc="location=yes,"; } else { loc="location=no,"; }
	if (prams.indexOf('t')!=-1) { tbar="toolbar=yes,"; } else { tbar="toolbar=no,"; }
	if (prams.indexOf('s')!=-1) { sbars="scrollbars=yes,"; } else { sbars="scrollbars=no,"; }
	if (prams.indexOf('d')!=-1) { directories="directories=yes,"; } else { directories="directories=no,"; }
	if (prams.indexOf('r')!=-1) { resizable="resizable=no"; } else { resizable="resizable=yes"; }
	
	str=loc+tbar+sbars+directories+W+H+x+y+resizable;

	newWindow=window.open(url,windowname,str);
	if (newWindow !=null && newWindow.opener==null) { newWindow.opener=window; }
}


// Sample action code
// -----------------------------------------------------------------------------
// <a class="noline" href="javascript:openWindow('/navto/page.html,750,525,,tigertrap');" 
// onMouseover="arrowOn('ar04');" onMouseout="arrowOff('ar04');">
// <font color="#666666"><b>Text Link</b></font></a>