// JavaScript Document
var agt=navigator.userAgent.toLowerCase();
var msie = agt.toLowerCase().indexOf('msie') > 0;
var isSafari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))				

$D = function (str) { 
	if (isSafari) return;
	if (!msie) dump(str + '\n');
}


dumpObject = function (obj)
{
	$D(sprintf('Dumping object (%s)------------------------------', typeof(obj) ));
	for (i in obj)
	{
			$D(sprintf("Property (%s) %s = %s", typeof(obj[i]), i, (typeof(obj[i]) == 'function' ? '{function}' : obj[i]) ));
	}
	$D('End Dump');
}

clear_debug = function()
{
	for (i = 0; i < 15; i++)
		$D('');
	$D('---------------------------------------------');
}

function writeYear() {
	RightNow = new Date();
	var TheYear = RightNow.getYear()
	
	if (TheYear >= 100 && TheYear <= 1999)
	{TheYear=TheYear + 1900}
	else
	{TheYear=TheYear}
	document.write(TheYear)
}


function confirmCancel(confirmWhat)	{
	return confirm("Are you sure you want to " + confirmWhat + "?");
}

sprintf = function (str){
    var arg = arguments;
    for(var i=0; i<arg.length; i++) if(arg[i]==undefined) arg[i] = ""; 
    i = 1;
    return str.replace(/(([^\\]?)%(s|d))/g, function(s, a1, a2){ return a2 + arg[i++]; });
}
flashBoxOpen = function(w){
	flashBoxClose(1);
	flashBoxClose(2);
	flashBoxClose(3);
	flashBoxClose(4);
	flashBoxClose(5);
	document.getElementById('leftMenu_'+w).style.display = "block";	
}
flashBoxClose = function(w){
	document.getElementById('leftMenu_'+w).style.display = "";	
}

var p1= null;
var p2=null;
var p3=null;
var p4=null;
var p5=null;
function hunterDouglasPopup()
{
	p1 = window.open('../www.janovic.com/ss/hunterdouglas_popup/index.html', 'HunterDouglas', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=740,height=650,left=20, top=20,screenX=20,screenY=20');
}

function brianOlsenPopup()
{
	p2 = window.open('../www.janovic.com/ss/brian_popup/index.html', 'Doug', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=740,height=500,left=20, top=20,screenX=20,screenY=20');
}
function brianOlsen2Popup()
{
	p4 = window.open('../www.janovic.com/ss/brian2_popup/index.html', 'BrianOlsen2', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=740,height=500,left=20, top=20,screenX=20,screenY=20');
}

function colorFestPopup()
{
	p3 = window.open('../www.janovic.com/ss/colorfest_popup/index.html', 'ColorFest', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=950,height=430,left=20, top=20,screenX=20,screenY=20');
}

function nav_pop(where)
{
	p3 = window.open(where, "Aura", 'scrollbars=yes,menubar=yes,toolbar=yes,statusbar=yes,resizable=yes,directories=yes,resizeable=yes,width=800,height=600,left=20, top=20,screenX=20,screenY=20');
}VirginiaPop
function contractorsPop()
{
	window.open('../www.janovic.com/assets/images/contractor/coupon/index.html', 'ContractorsClub', 'scrollbars=yes,menubar=no,toolbar=no,statusbar=no,resizable=yes,directories=no,width=400,height=600');
}
function VirginiaPop()
{
	window.open('../www.janovic.com/assets/images/virginia/index.html', 'VirginiaPop', 'scrollbars=yes,menubar=no,toolbar=no,statusbar=no,resizable=yes,directories=no,width=410,height=640');
}

function navigate(where){
	if(window.location.toString().toLowerCase().indexOf('/ss/') < 1 )
		window.location = where;
	else
		window.opener.location = where;	
}

function switchImageGallery(directory){
	var videos = new Array();
	videos['images/'] = '../www.youtube.com/v/jE3IU7sq5xk&hl=en&fs=1';
	videos['imglexington/'] = '../www.youtube.com/v/AWLI4Ob_bTk&hl=en&fs=1';
	
	// add video 
	document.getElementById('janvideo').innerHTML = '<object width="330" height="266"><param name="movie" value="'+videos[directory]+'"></param><embed src="'+videos[directory]+'" type="application/x-shockwave-flash" width="330" height="266"></embed></object>';
	
	// <![CDATA[
	var so = new SWFObject("ss/gallery/~gallery2.swf", "gallery", "355", "300", "8", "#ffffff");
	so.addParam("allowScriptAccess","always");
	so.addVariable('dir',directory);
	so.addParam("style","width: 355px !important;height: 350px !important;");
	so.write("flashContent3");
	// ]]>
	
}
