function popUpWindowKV(myPage, key, value) 
{
  var url = "" + myPage + "?" + key + "=" + value;
  var win = window.open(url,'MyWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600,left = 237,top = 84');
  win.focus();    
}
function popUpWindowKV2(myPage, key1, value1, key2, value2) 
{
  var url = myPage + "?" + key1 + "=" + value1 + "&" + key2 + "=" + value2;
  var win = window.open(url,'MyWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600,left = 237,top = 84');
  win.focus();    
}
function popUpWindowKV3(myPage, key1, value1, key2, value2, key3, value3) 
{
  var url = myPage + "?" + key1 + "=" + value1 + "&" + key2 + "=" + value2 + "&" + key3 + "=" + value3;
  var win = window.open(url,'MyWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600,left = 237,top = 84');
  win.focus();    
}
function popUpWindowKV4(myPage, key1, value1, key2, value2, key3, value3, key4, value4) 
{
  var url = myPage + "?" + key1 + "=" + value1 + "&" + key2 + "=" + value2 + "&" + key3 + "=" + value3 + "&" + key4 + "=" + value4;
  var win = window.open(url,'MyWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600,left = 237,top = 84');
  win.focus();    
}
function popUpWindow( myPage) 
{
  var url = myPage;
  var win = window.open(url,'MyWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600,left = 237,top = 84');
  win.focus();    
}
function popUpHtml( myPage) 
{
  var win = window.open(myPage,'MyWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=600,left = 237,top = 84');
  win.focus();    
}
function popUpHtmlSizable( myPage, width, height) 
{
  var win = window.open(myPage,'MyWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=' + width + ',height=' + height + ',left = 237,top = 84');
  win.focus();    
}

function lightBox( type, url)
{
  if ( document.body.scrollWidth)
  {
    docWidth = document.body.scrollWidth + 'px' ;
    docHeight = document.body.scrollHeight + 'px' ;
  }
  else
  {
    docWidth = '100%';
    docHeight = '100%';
  }

  switch (type+resolution())
  {
    case "roomSettingLow": { w = 650; h = 485; break; }
    case "roomSettingMed": { w = 650; h = 485; break; }
    case "roomSettingHi" : { w = 650; h = 485; break; }
    case "colorLow"      : { w = 375; h = 500; break; }
    case "colorMed"      : { w = 375; h = 500; break; }
    case "colorHi"       : { w = 375; h = 500; break; }	
    case "hdofflineLow"  : { w = 450; h = 300; break; }
    case "hdofflineMed"  : { w = 450; h = 300; break; }
    case "hdofflineHi"   : { w = 450; h = 300; break; }	
	case "optionLow"     : { w = 450; h = 400; break; }
    case "optionMed"     : { w = 450; h = 400; break; }
    case "optionHi"      : { w = 450; h = 400; break; }	
    case "wdswatchLow"   : { w = 300; h = 200; break; }
    case "wdswatchMed"   : { w = 300; h = 200; break; }
    case "wdswatchHi"    : { w = 300; h = 200; break; }	
    case "swatchMed"     : { w = 300; h = 200; break; }
    case "swatchHi"      : { w = 300; h = 200; break; }		
	case "whyproductLow" : { w = 752; h = 600; break; }	
	case "whyproductMed" : { w = 752; h = 600; break; }	
	case "whyproductHi"  : { w = 752; h = 600; break; }		
	case "htmlLow"		 : { w = 500; h = 400; break; }	
	case "htmlMed"		 : { w = 500; h = 400; break; }	
	case "htmlHi" 		 : { w = 500; h = 400; break; }			
	case "greenLow"		 : { w = 350; h = 325; break; }	
	case "greenMed"		 : { w = 350; h = 325; break; }	
	case "greenHi" 		 : { w = 350; h = 325; break; }			
    default              : { w = 800; h = 500; break; }
  }

  var x = Geometry.getHorizontalScroll() + Geometry.getViewportWidth()/2 - w/2;
  var y = Geometry.getVerticalScroll() + Geometry.getViewportHeight()/2 - h/2;

  var item = document.getElementById('block');
  item.innerHTML='<iframe id="blockIframe" src="/blockIframe.jsp" frameborder="0" scrolling="no" width="' + docWidth + '" height="' + docHeight + '" style="filter:alpha(opacity=65); -moz-opacity:0.65; opacity:0.65; position:absolute; top:0; left:0; color:#000; background-color:#000; border:0; margin:0; padding:0;"/>';
  item.style.display="block";

  var style = 'position:absolute;';
  item = document.getElementById('lightbox');
  item.innerHTML='<iframe id="lightboxIframe" frameborder="0" scrolling="no" allowTransparency="true"'
    + ' src="'+ url + '"'
    + ' style="' + lbLocation( y, x) + lbSize( w, h) + style + '"'
    + '/>';
  item.style.display="block";
}

function closeLightBox()
{
  closeThisLightBox( parent.document, 'block', 'lightbox');   
}

function closeThisLightBox( obj, blockerName, lightboxName)
{
  var item = obj.getElementById( blockerName);
  item.innerHTML ='';
  item.style.display="none";  
  item = obj.getElementById( lightboxName);
  item.innerHTML=''; 
  item.style.display="none";  
}

function lbSize( w, h)
{
  return 'width:' + w + 'px; height:' + h + 'px;';
}
function lbLocation( down, over)
{
  return 'top:' + down + '; left:' + over + ';';
}


function resolution()
{
  if ( screen.width < 1024)
  {
    return 'Low';
  }
  else if ( screen.width < 1280)
  {
    return 'Med';
  }
  else
  {
    return 'Hi';
  }

}

function popUpHtmlSizable( myPage, width, height) 
{
  var xpop = Geometry.getHorizontalScroll() + Geometry.getViewportWidth()/2 - width/5;
  var ypop = Geometry.getViewportHeight()/2 - height/5;
  var win = window.open(myPage,'MyWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ', top=100, left=200');
  win.focus();    
}
