


/*************** open print window */
var printWin;

function Print(x){
/* check value of x */
    var printURI;
    if (x == null){
    printURI = "";
    } else {
    printURI = x;
    }

/* execute open popup window */
	if (printWin == null || printWin.closed){
		printWin = window.open(printURI,"","toolbar=no,personal=no,menubar=no,status=yes,resizable=yes,width=600,height=400,location=no,scrollbars=yes");
		}else{
		printWin.focus();
		printWin.location.replace(printURI);
		
		
	}
	
	
	
}
var newwindow;
function popoup(url)
{
	newwindow=window.open(url,'name','toolbar=yes, location=yes,directories=no,status=no,menubar=no,copyhistory=yes,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}


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

function changepic(img_name,img_src, title, desc) {
document.getElementById(img_name).src=img_src;
document.getElementById(img_name).alt=title;
document.getElementById(img_name).title=desc;
var titleRef = document.getElementById('titleBox');
titleRef.innerHTML = title+"<br>"+desc;
}


function pop(theURL,winName,features) { //v2.0
 if( theURL.indexOf("http") == -1){
 	theURL="/"+theURL;
 }
  winName = window.open(theURL,'',features);
  winName.focus();
}
function popout(theURL,winName,features) { //v2.0
  winName = window.open(theURL,'',features);
  winName.focus();
}
/**
 * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
 */

function writeFlash(p) {
	writeEmbed(
		'D27CDB6E-AE6D-11cf-96B8-444553540000',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'application/x-shockwave-flash',
		p
	);
}

function writeShockWave(p) {
	writeEmbed(
	'166B1BCA-3F9C-11CF-8075-444553540000',
	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
	'application/x-director',
		p
	);
}

function writeQuickTime(p) {
	writeEmbed(
		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
		'video/quicktime',
		p
	);
}

function writeRealMedia(p) {
	writeEmbed(
		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'audio/x-pn-realaudio-plugin',
		p
	);
}

function writeWindowsMedia(p) {
	p.url = p.src;
	writeEmbed(
		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
		'application/x-mplayer2',
		p
	);
}

function writeEmbed(cls, cb, mt, p) {
	var h = '', n;

	h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
	h += '>';

	for (n in p)
		h += '<param name="' + n + '" value="' + p[n] + '">';

	h += '<embed type="' + mt + '"';

	for (n in p)
		h += n + '="' + p[n] + '" ';

	h += '></embed></object>';

	document.write(h);
}


function setActiveStyleSheet(title) {

  var i, a, main, s;
  document.getElementById("styles").style.color='#4accd4';
  document.getElementById("stylem").style.color='#4accd4';
  document.getElementById("stylel").style.color='#4accd4';
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && a.getAttribute("title")!="Horizontal") {
      a.disabled = true;
     
      if(a.getAttribute("title") == title) {
      		a.disabled = false; 
      		
      		s = document.getElementById("style"+a.getAttribute("title"));
      		
      		s.style.color='#cccccc';
      		
      		}
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  //var cookie = readCookie("style");
  //var title = cookie ? cookie : getPreferredStyleSheet();
  //setActiveStyleSheet(title);
}

window.onunload = function(e) {
  //var title = getActiveStyleSheet();
  //createCookie("style", title, 365);
}

function currentBrowser() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.v = parseInt(navigator.appVersion)	
	this.min = parseFloat(navigator.appVersion)
	this.opera = (navigator.userAgent.indexOf('Opera')>0)
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	this.ie55 = (navigator.userAgent.indexOf('MSIE 5.5')>0)
	this.ie6 = (navigator.userAgent.indexOf('MSIE 6')>0)
	this.ie7 = (navigator.userAgent.indexOf('MSIE 7')>0)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.dom = (this.ie5 || this.ie7 || this.ie6 || this.opera || this.ns5)
	this.ie = (this.b=="ie" && this.v>=4)
}

me = new currentBrowser()

function browserObject() {
	if (me.ie && !me.opera) {
		this.bodyWidth = parseInt(document.body.clientWidth)-8
		this.bodyHeight = parseInt(document.body.clientHeight)-8
	}
	else {
		this.bodyWidth = parseInt(window.innerWidth)
		this.bodyHeight = parseInt(window.innerHeight)
	}
	this.screenHeight = screen.availHeight
	this.screenWidth = screen.availWidth
	this.screenActualHeight = screen.height
	this.screenActualWidth = screen.width
}
