<!--	common scripts file

var dayName=new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monName=new Array ("January","February","March","April","May","June","July","August","September","October","November","December")
var yearName="2009"
var now=new Date

function newWindow(print){
printWindow=window.open(print,'printWin', 'WIDTH=550,HEIGHT=400,SCROLLBARS=yes,RESIZABLE=yes')
printWindow.focus()
}

function updateParent(newURL) {
opener.document.location=newURL
}

function closeWindow() {
if(window && !window.closed) {
window.close()
}
}

function PrintPage() {
if (window.print){
window.print();
}else{
alert("Your browser does not support printing a page using this button (requires Internet Explorer 5 or Netscape Navigator 4).\n" +
"However, you can print in several other ways (after clicking OK below):\n" +
"* Press Ctrl-P\n" +
"* Right Click, then select Print\n" +
"* Select File > Print from the menu bar at the top of the screen");
	}
}

function jumpPage(newLoc) {
	newPage = newLoc.options[newLoc.selectedIndex].value

	if (newPage != "") {
		window.location.href = newPage
	}
}


// previous functions here...

var isMinNS4 = 0;    // Netscape 4.0 or higher
var isMinIE4 = 0;		// Internet Explorer 4.0 or higher
var isMinIE5 = 0;		// Internet Explorer 5.0 or higher
var isNS6 = 0;			// Netscape 6.0

isMinNS4 = (document.layers) ? 1 : 0;
isMinIE4 = (document.all) ? 1 : 0;
isMinIE5 = (document.getElementById&&document.all) ? 1 : 0;
isNS6 = (document.getElementById&&!document.all) ? 1 : 0;

var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function hide(id)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all(id):d.layers(id);
	el.style.visibility="hidden";
	el.style.height='0';
}

function unhide(id)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all(id):d.layers(id);
	el.style.visibility="visible";
	el.style.height='auto';
}

function cconnect(url) {
  if(confirm("You are now going to a website not operated by StrandVision.\nWe are not responsible for the content of this site and the privacy\nand security policies may differ from those practiced by StrandVision."))
  {
//	 if(document.images){ (new Image()).src="ls.php?url="+escape(el.href);}return true; }
	 if(document.images){ (new Image()).src="ls.php?url="+escape(url); }
    window.open(url, '_blank');
  }
}

function connect(el) {
if(document.images) {(new Image()).src="ls.php?url="+escape(el.href);}
return true;
}
function hc(el) {
if(document.images) {(new Image()).src="ls.php?url="+escape(el.href);}
return true;
}
function hc1(el) {
if(document.images) {(new Image()).src="../ls.php?url="+escape(el.href);}
return true;
}
function dc() {
if(document.images) {(new Image()).src="ls.php?dc="+rnd(99999)+"&url="+escape(window.location.href);}
return true;
}
function dc1() {
if(document.images) {(new Image()).src="../ls.php?dc="+rnd(99999)+"&url="+escape(window.location.href);}
return true;
}
function rnd(scale) {
var dd=new Date();
return((Math.round(Math.abs(Math.sin(dd.getTime()))*1000000000)%scale));
}
function GoUrl(url)
{
	window.location.href = url;
	return false;
}

function OpenUrl(URL, frame)
{
 NW = window.open(URL, frame);
 if (NW)
 {
	 NW.blur();		// lose focus
	 NW.focus();	// get focus
 }
}

function printPopup(URL)
{
 PrintWin = window.open(URL, "PrintWin");
 // if (isMinIE4 || isMinNS4)
 {
	setTimeout("{PrintWin.print(); PrintWin.close();}",2000);		// print and close after 2 seconds
 }
}

function openKiosk(URL, windowW, windowH, autoclose, fullscreen)
{
 features='left=0,top=0';
 if (fullscreen || windowH<0 || windowW<0)
 {
 	windowH = getScreenHeight();
 	windowW = getScreenWidth();
 }
 if (windowW > 0 && windowH > 0)
 	features +=',width='+windowW+',height='+windowH;
 features+=',location=0,menubar=0,status=0,resizable=1,scrollbars=0,location=0,toolbar=0';
 if (fullscreen)		// if internet explorer
 	features+=',fullscreen=1';
 KW = window.open(URL,"Kiosk", features);
 if (KW)
 {
//    KW.body.scroll=0;
	 KW.blur();		// lose focus
	 KW.focus();	// get focus
	 KW.resizeTo(windowW,windowH);
	 if (autoclose)
		window.onunload = function(){KW.close();}
 }
 else
 	alert('Automatic Popup windows are disabled for your browser.\nTo open your kiosk you must manually click the link below.');
 return KW;
}

function openSample(URL)
{
 features='left=1,top=1,width=620,height=480';
 features+=',location=no,menubar=no,resizable=yes,status=no,scrollbars=no,toolbar=no';
 KW = window.open(URL,"Sample", features);
 if (KW)
 {
	KW.blur();		// lose focus
	KW.focus();	// get focus
 	window.onunload = function(){KW.close();}
 }
}

function openPreview(URL)
{
	features='top=1,left=1,width='+(getScreenWidth()-6)+',height='+(getScreenHeight()-180);
	features += ',location=1,menubar=1,resizable=1,status=1,scrollbars=1,toolbar=1';
 KW = window.open(URL,"Kiosk", features);
 if (KW)
 {
//	KW.blur();		// lose focus
	KW.focus();	// get focus
// 	window.onunload = function(){KW.close();}
 }
}

function openColor(URL)
{
 features='left=1,top=1,width=270,height=380';
 features+=',location=no,menubar=no,resizable=yes,status=no,scrollbars=no,toolbar=no';
 KW = window.open(URL,"Color", features);
 if (KW)
 {
	KW.blur();		// lose focus
	KW.focus();	// get focus
 	window.onunload = function(){KW.close();}
 }
}

function getScreenWidth()
{
 	windowH = screen.height;
 	windowW = screen.width;
 	if (windowW > windowH*2)		// if a double wide screen
 		windowW /= 2;					// cut in half
	return windowW;
}

function getScreenHeight()
{
 	windowH = screen.height;
	return windowH;
}

function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}

function toggle(field)
{
	field = 'document.'+field;
	field = eval(field);
	field.checked = !field.checked;
}

function setchg(form)
{
	field = 'document.'+form+'.change';
	field = eval(field);
	field.value = 'Y';
}

var name;
var military;
var datesep;
var timesep;

function showdatetime(name, military, datesep, timesep)
{
	var Dt = new Date();
	var year = Dt.getYear();
	var month = Dt.getMonth();
	var day = Dt.getDay();
	var date = Dt.getDate()-1;
	var hours = Dt.getHours();
	var minutes = Dt.getMinutes();
	var seconds = Dt.getSeconds();
	if (year < 2000)
		yr = new String(year+1900);
	else
		yr = new String(year);
	mn = new String(month+1);
	dy = new String(date+1);
	if (military > '0')
		dn = '';
	else
	{
		dn = "AM";
		if ((hours >= 12) && (minutes >= 1) || (hours >= 13))
		{
			dn = "PM";
			hours = hours-12;
		}
		if (hours == 0)
			hours = 12;
	}
	h = new String(hours);
	if (military > '0')
	{
		if (hours < 10)
			h = '0'+h;
	}
	m = new String(minutes);
	if (minutes < 10)
		m = '0'+m;
	s = new String(seconds);
	if (seconds < 10)
		s = '0'+s;

	nameptr = eval('document.'+name);
	nameptr.value = mn+datesep+dy+datesep+yr+'  '+h+timesep+m+timesep+s+' '+dn;
	var command = "showdatetime('"+name+"','"+military+"','"+datesep+"','"+timesep+"')";
	setTimeout(command, 1000);
}

function statusin(field)
{
	window.status=field.title;
	return true;
}

function statusout()
{
	window.status=" ";
	return true;
}

function refresh_close($url)
{
	opener.parent.location=$url;
	self.close();
}

function getparams()
{
	u = document.location.toString();
	pos = u.indexOf("?")+1;
	//alert(u+pos);
	var fld="";
	if (pos>-1)
		fld = u.substring(pos);
	return fld;
}

function retF(){
var thisF= this.window
var allF = parent.top.frames;
for(var i=0;i<allF.length;i++)
if(allF[i]==thisF){
	var frameName=allF[i].name; // this is the variable you are looking for
	alert(frameName);//only for test, remove this line later
	break;
}
return frameName;
}

function noFrames()
{
if (top!=self.parent)
	top.location=self.parent.location;
}

function GetCookie(name)
{
	if (document.cookie.length>0)
	{
		var start = document.cookie.indexOf(name+"=");
		var len = start+name.length+1;
		if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
		if (start == -1) return "";
		var end = document.cookie.indexOf(";",len);
		if (end == -1) end = document.cookie.length;
		return unescape(document.cookie.substring(len,end));
	}
	return "";
}
function SetCookie(name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString());
}
function RevealSelect(id,prefix)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all(id):d.layers(id);
	if (!el)
	{
		id += "[]";
		var el=d.getElementById?d.getElementById(id):d.all?d.all(id):d.layers(id);
	}

	var selected = el.value;
	var first = false;
	for (var i=0; i<el.options.length; i++)
	{
		var thisopt = el.options[i];
		if (thisopt.value.substring(0,prefix.length) != prefix)
		{
			thisopt.style.display="none";
			if (thisopt.value == selected)
				selected = false;
		}
		else
		{
			thisopt.style.display="";
			if (!first)
				first = thisopt.value;
		}
	}
	if (!selected)
		el.value = first;
}
/*
var mainuserwindow;
window.name = "mainuserwindow";
mainuserwindow = window;

function jopup(url,h,w)
{
    TopPosition=(screen.height)?(screen.height-h)/2:100;
    LeftPosition=(screen.width)?(screen.width-w)/2:100;
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,status=yes';

    if((!OpenWindow) || (OpenWindow.closed == true)) {
        var OpenWindow=window.open(url, "newwin", settings);
        OpenWindow.focus();
    }
    else {
        OpenWindow.location.href = url;
        OpenWindow.focus();
    }
}

function startpop(url,myname,w,h)
{
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',toolbar=yes,scrollbars=yes,directories=yes,location=yes,menubar=yes,resizable=yes,status=yes';

	if((!StartWindow) || (StartWindow.closed == true))
	{
		var StartWindow=window.open(url, "startwin", settings);
		StartWindow.focus();
	}
	else
	{
		OpenWindow.location.href = url;
		OpenWindow.focus();
	}
}

function popstart(mypage,myname,w,h)
{
	var win=null;
	var mainuserwindow;
	mainuserwindow = window;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',toolbar=yes,scrollbars=yes,directories=yes,location=yes,menubar=yes,resizable=yes,status=yes';
	win=window.open(mypage,myname,settings);
}

function openp()
{
	var tsuser = GetCookie('SAS');
	if (tsuser == null)
	{
		tsuser = GetCookie('ASTR');
		if (tsuser == null)
		{
		   window.open('popups/openp.html','open','width=10,height=10,top=5000,left=5000,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
		}
	}
}

// Returns true if the version meets the passed-in minimum version.
function flashVersionMeets(sMinVersion) {
var $min = sMinVersion.split('.'), $ver = getFlashVersion().split('.');
while ($min.length < 4) $min.push(0); while ($ver.length < 4) $ver.push(0);
for (var x = 0; x < 4; x++) {
if (Number($ver[x]) > Number($min[x])) return true;
if (Number($ver[x]) < Number($min[x])) return false;
}
return true;
};

// Returns the version of flash that the user has installed, or 0 if none.
function getFlashVersion() {
if(navigator.plugins && navigator.mimeTypes.length) {
var oFlash = navigator.plugins['Shockwave Flash'];
if (oFlash && oFlash.description) {
return oFlash.description.replace(/([a-z]|[A-Z]|\s)+/, '').replace(/(\s+r|\s+b[0-9]+)/, '.');
}
} else if (window.ActiveXObject) {
try {
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').split(' ')[1].replace(/,/g, '.');
} catch (e) {}
}
return '0';
};
*/
//-->

