﻿var stickOn = false; 

var popUp; 

function OpenFileBrowser(idname, folder, postBack, folderdepth)
{
	url = '/filebrowser.aspx' +
		'?formname=' + document.forms[0].name +
		'&id=' + idname +
		'&filename=' + document.forms[0].elements[idname].value +
		'&folder=' + folder +
		'&postBack=' + postBack +
		'&folderdepth=' + folderdepth

	popUp = window.open(url, 'filebrowser','width=800,height=800,left=200,top=250,scrollbars=yes,location=no,toolbar=no');
}

function SetFile(formName, id, newFile, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newFile;
}

function OpenCalendar(idname, postBack)
{
	popUp = window.open('Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=200,height=250,left=200,top=250');
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
}		


function Confirm_LogOff() {
	var deleteOK = confirm("Are you sure you want to log off?")
	if (deleteOK == true)
	{
		return(true);
	}
	else
	{
		return(false);
	}
}

function Confirm_Delete(name) {
	var deleteOK = confirm("Are you sure you want to delete \"" + name + "\"?")
	if (deleteOK == true)
	{
		return(true);
	}
	else
	{
		return(false);
	}
}

function Confirm_DeActivate(name) {
	var deleteOK = confirm("Are you sure you want to de-activate \"" + name + "\"?")
	if (deleteOK == true)
	{
		return(true);
	}
	else
	{
		return(false);
	}
}

function Confirm_Action(message) {
	var confirmOK = confirm(message)
	if (confirmOK == true)
	{
		return(true);
	}
	else
	{
		return(false);
	}
}

function roll(obj, highlightcolor){
	if (stickOn == false)
	{
    obj.style.backgroundColor = highlightcolor;
	}
}

function stick(obj, highlightcolor){
  obj.style.backgroundColor = highlightcolor;
  
  stickOn = true;
}

function cancelClick() {
  stickOn = false;
}

// Move an element directly on top of another element (and optionally
// make it the same size)
function Cover(bottom, topbit, datagrid, datarow, bubbletype) {
  var location = Sys.UI.DomElement.getLocation(bottom);
  var bounds = Sys.UI.DomElement.getBounds(bottom);

  var datagridBounds = Sys.UI.DomElement.getBounds(datagrid);
  var datagridlocation = Sys.UI.DomElement.getLocation(datagrid);

  var datarowlocation = Sys.UI.DomElement.getLocation(datarow);

  //topbit.style.position = 'absolute';

  topbit.style.left = datagrid.scrollWidth - bottom.offsetLeft - 350 + 'px';
  //topbit.style.left = bottom.offsetLeft + 'px';

  //alert('datagrid.scrollWidth:'+datagrid.scrollWidth);
  //alert('bottom.offsetLeft:'+bottom.offsetLeft);

  if (bubbletype == 1) {
    topbit.style.top = datarow.offsetTop - 180 + 'px';
  } else {
    topbit.style.top = datarow.offsetTop + 10 + 'px';
  }
}






function CallPrint(strid)
{
 var prtContent = document.getElementById(strid);
 var strOldOne=prtContent.innerHTML;
 var WinPrint = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
 
 WinPrint.document.write('<LINK href="../css/buylocal.css" type="text/css" rel="stylesheet">');
 WinPrint.document.write('<LINK href="../css/code-specific.css" type="text/css" rel="stylesheet">');
 WinPrint.document.write(prtContent.innerHTML);
 WinPrint.document.close();
 WinPrint.focus();
 WinPrint.print();
 WinPrint.close();
 
 prtContent.innerHTML=strOldOne;
}

function writemenu(menuname) {
	var d = document.getElementById('f-source-menu');

  d.innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="500" height="500" >' + 
    '<param name="flash_component" value="VistaVerticalFree.swc">' + 
    '<param name="movie" value="moview.swf">' + 
    '<param name="quality" value="high">' + 
    '<param name="FlashVars" value="flashlet={_subButtonTextColor:#FFFFFF,_subMenuColor:#1E1E1E,_removeSubDelay:500,_mainButtonHeight:26,_subHighlightColor:#999999,mainSoundURL:\'None\',_subFont:\'Trebuchet MS\',_subButtonHeight:23,_menuColor:#131313,clickSoundURL:\'None\',_mainButtonTextColor:#FFFFFF,_menuWidth:100,_mainFontSize:11,subSoundURL:\'None\',_subHlTransparency:50,bg_Pic_URL:\'None\',_minSubWidth:60,_mainFont:\'Trebuchet MS\',_mainButWidthExt:22,_mainHighlightColor:#92DDFA,xml_Path:\''+menuname+'\',_subFontSize:10}">' + 
    '<param name="wmode" value="transparent">' + 
    '</object>';
}

