// <![CDATA[

function openDemo() {
	var load = window.open('ioipay_demo.php','','scrollbars=no, menubar=no,height=550,width=750,resizable=no,toolbar=no,location=no,status=no'); 
}

function AE_AttachEventSetup(oObj) {
	oObj.aeFN = new Array();
	oObj.attachEvent = AE_AttachEventFn;
	window.onload = AE_WindowOnload;
	window.onresize = AE_WindowOnresize;
}

function AE_AttachEventFn(sEvent, fpNotify) {
	if (this.aeFN[sEvent])
		this.aeFN[sEvent][this.aeFN[sEvent].length] = fpNotify;
	else {
		this.aeFN[sEvent] = new Array();
		this.aeFN[sEvent][this.aeFN[sEvent].length] = fpNotify;
	}
}

function AE_AttachEvent(sEvent, fpNotify) {
	if (!(sEvent == "onload" || sEvent == "onresize")) return;
	AE_oWindow.attachEvent(sEvent, fpNotify);
}

function AE_PlayEvent(sEvent) {
	eval("window." + sEvent);
	if (AE_oWindow.aeFN[sEvent])
		for (var i=0;i<AE_oWindow.aeFN[sEvent].length;i++)
			eval(AE_oWindow.aeFN[sEvent][i] + "()");
}

function AE_WindowOnload() {
	AE_PlayEvent("onload");
}

function AE_WindowOnresize() {
	AE_PlayEvent("onresize");
}

var AE_oWindow = new Object();
AE_AttachEventSetup(AE_oWindow);

/******************************************************************************
 This is the flash detection script.
 ******************************************************************************/
var required = 6;
var hasFlash = false;
if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") != -1){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	// AFAIK creating an instance of an older version of the Flash object 
	// will return succeed even if the actual installed version is newer.
	document.write('hasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & required))) \n');  
	document.write('<'+'/scr' + 'ipt\> \n');
	}
else {
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])?navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin:0;
	if (plugin) {
		var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		hasFlash = flashVersion >= required;
		}
	}


/******************************************************************************
 This classes the <html> element as `hasFlash` if flash is found. This style
 hook can be used to hide our to-be-replaced content before it even comes down
 the datapipe and eliminate the FOPSC ("Flash of Partially Styled Content")
 
 I've determined that the lighter the page weight the greater chance of a FOPSC.
 ******************************************************************************/
if (hasFlash && document.getElementsByTagName && document.getElementsByTagName('html')[0]) {
	document.getElementsByTagName('html')[0].className += (document.getElementsByTagName('html')[0].className=='')?'hasFlash':' hasFlash';
	}
	
	
/******************************************************************************
 Some utility functions. Look at them--aren't they useful?
 ******************************************************************************/
 
function SI_normalizeWhiteSpace(txt) {
	var rE = /\s+/gi;
	return txt.replace(rE,' ');
	}
function SI_forceRedraw() {
	// Corrects a margin-bottom sum bug in Mozilla
	var d = document;
	if (d.body && d.body.style) {
		d.body.style.height = "1px";
		d.body.style.height = "auto";
		}
	}
	

/******************************************************************************
 This is the function that finds and replaces the appropriate elements.
 
 
 SI_replaceElement(elem,swf,w,h,afv)
 
	elem (string) :
		`div#header` will replace the `div` with the id of header
		`div#primary-content>h1` will replace any `h1` tag whose direct parent is a `div` with an id of `primary-content`
		`h2.replaceme` will replace any `h2` tag with a className of `replaceme`
	swf (string) :
		full path to the swf
	w (int) :
		width
	h (int) :
		height
	afv (string) :
		used to pass additional flashVars to the movie
	 
 The new replaced element will be placed in a div 
 with a className of `'replaced-'+r.e.tagName`
 ******************************************************************************/
function SI_replaceElement(elem,swf,w,h,afv) {
	var d = document;
	
	if (!hasFlash || !d.getElementsByTagName) return;
	
	var r = new Object();
	r.p = new Object();
	r.e = new Object();
	
	if (elem.indexOf('>')!=-1) {
		//alert('Reference to parent found...');
		elemArray = elem.split('>');
		elem = elemArray[1];
		if (elemArray[0].indexOf('#')!=-1) {
			//alert('Reference to parent\'s id found...');
			parentArray = elemArray[0].split('#');
			r.p.id 		  = parentArray[1];
			r.p.tagName	  = parentArray[0];
			r.p.className = false;
			}
		else if (elemArray[0].indexOf('.')!=-1) {
			//alert('Reference to parent\'s className found...');
			parentArray = elemArray[0].split('.');
			r.p.id 		  = false;
			r.p.tagName	  = parentArray[0];
			r.p.className = parentArray[1];
			}
		else {
			r.p.id		  = false;
			r.p.tagName	  = elemArray[0];
			r.p.className = false;
			}
		}
	else {
		//alert('No reference to parent found...');
		r.p.id		  = false;
		r.p.tagName	  = false;
		r.p.className = false;
		}
	
	if (elem.indexOf('#')!=-1) {
		//alert('Reference to element\'s id found...');
		elemArray = elem.split('#');
		r.e.id 		  = elemArray[1];
		r.e.tagName	  = elemArray[0];
		r.e.className = false;
		}
	else if (elem.indexOf('.')!=-1) {
		//alert('Reference to element\'s className found...');
		elemArray = elem.split('.');
		r.e.id 		  = false;
		r.e.tagName	  = elemArray[0];
		r.e.className = elemArray[1];
		}
	else {
		r.e.id		  = false;
		r.e.tagName	  = elem;
		r.e.className = false;
		}
	
	if (afv!='') {
		afv = SI_normalizeWhiteSpace(afv);
		afv = '&'+afv;
		}
	
	var elems = d.getElementsByTagName(r.e.tagName);
	var count = elems.length;
	for (var i=0; i<count; i++) {
		e = elems[i];
		
		if (!r.p.tagName || (((r.p.tagName && !r.p.id && !r.p.className && e.parentNode.nodeName==r.p.tagName.toUpperCase()) || ((r.p.id && e.parentNode.id==r.p.id) || (r.p.className && e.parentNode.className==r.p.className))))) {
			if ((r.e.tagName && !r.e.id && !r.e.className) || (r.e.id && e.id==r.e.id) || (r.e.className && e.className==r.e.className)) {
				
				//alert('Make replacement');
				var txt;
				txt = SI_normalizeWhiteSpace(e.innerHTML);
				var c = d.createElement('div');
				c.className = 'replaced-'+r.e.tagName;
				e.parentNode.replaceChild(c,e);
				// The replaceChild acts like shift() on the
				// array that holds all of our elems. Meaning it
				// removes the first index and the remaining indexes
				// move up one.
				// The length or our elems array decreases by one
				count--;
				// Override the increment on loop index too.
				// We could just use e = elems[0]; above if we knew that
				// every instance of this particular element was going 
				// to be replaced--but there's no way of knowing that's
				// how it will play out.
				i--;
				var fv	= 'txt='+escape(txt)+afv;
				
				var swfHTML;
				swfHTML  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'">';
				swfHTML += '	<param name="movie" value="'+swf+'" />';
				swfHTML += '	<param name="flashvars" value="'+fv+'" />';
				swfHTML += '	<embed src="'+swf+'" flashvars="'+fv+'" width="'+w+'" height="'+h+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />';
				swfHTML += '<'+'/object>';
				c.innerHTML = swfHTML;
				txt='';
				}
			}
		
		}
	}
	
	
/******************************************************************************
 This is where the magic happens. This should really be the only part of this
 script you need to modify. Just add the necessary SI_replaceElement() calls 
 and make sure this sucker is called onload.
 ******************************************************************************/
function SI_flashReplacement() {
	// Replace all `<h1>` tags inside `<div id="primary-content">`
	SI_replaceElement('div.home>h3','style/header.swf',263,121,'');
	
	// Another Sample:
	// Replace all occurances of `<h3 class="author">` inside `<div class="comment">`
	// Also pass the additional variable `type` a value of `2` to Flash
	// SI_replaceElement('div.comment>h3.author','swf/txt.swf',236,18,'type=2');
	
	SI_forceRedraw();
	}


/******************************************************************************
 This sets the entire thing in motion. Place any other scripts that need to run
 onload in the SI_onload() function or add SI_flashReplacement to your own 
 onload handler.
 ******************************************************************************/
function SI_onload() {
	SI_flashReplacement();
	} 

AE_AttachEvent("onload", "SI_onload");

// minmax.js: make IE5+/Win support CSS min/max-width/height
// version 1.0, 08-Aug-2003
// written by Andrew Clover <and@doxdesk.com>, use freely

/*@cc_on
@if (@_win32 && @_jscript_version>4)

var minmax_elements;

minmax_props= new Array(
  new Array('min-width', 'minWidth'),
  new Array('max-width', 'maxWidth'),
  new Array('min-height','minHeight'),
  new Array('max-height','maxHeight')
);

// Binding. Called on all new elements. If <body>, initialise; check all
// elements for minmax properties

function minmax_bind(el) {
  var i, em, ms;
  var st= el.style, cs= el.currentStyle;

  if (minmax_elements==window.undefined) {
    // initialise when body element has turned up, but only on IE
    if (!document.body || !document.body.currentStyle) return;
    minmax_elements= new Array();
    window.attachEvent('onresize', minmax_delayout);
    // make font size listener
    em= document.createElement('div');
    em.setAttribute('id', 'minmax_em');
    em.style.position= 'absolute'; em.style.visibility= 'hidden';
    em.style.fontSize= 'xx-large'; em.style.height= '5em';
    em.style.top='-5em'; em.style.left= '0';
    if (em.style.setExpression) {
      em.style.setExpression('width', 'minmax_checkFont()');
      document.body.insertBefore(em, document.body.firstChild);
    }
  }

  // transform hyphenated properties the browser has not caught to camelCase
  for (i= minmax_props.length; i-->0;)
    if (cs[minmax_props[i][0]])
      st[minmax_props[i][1]]= cs[minmax_props[i][0]];
  // add element with properties to list, store optimal size values
  for (i= minmax_props.length; i-->0;) {
    ms= cs[minmax_props[i][1]];
    if (ms && ms!='auto' && ms!='none' && ms!='0' && ms!='') {
      st.minmaxWidth= cs.width; st.minmaxHeight= cs.height;
      minmax_elements[minmax_elements.length]= el;
      // will need a layout later
      minmax_delayout();
      break;
  } }
}

// check for font size changes

var minmax_fontsize= 0;
function minmax_checkFont() {
  var fs= document.getElementById('minmax_em').offsetHeight;
  if (minmax_fontsize!=fs && minmax_fontsize!=0)
    minmax_delayout();
  minmax_fontsize= fs;
  return '5em';
}

// Layout. Called after window and font size-change. Go through elements we
// picked out earlier and set their size to the minimum, maximum and optimum,
// choosing whichever is appropriate

// Request re-layout at next available moment
var minmax_delaying= false;
function minmax_delayout() {
  if (minmax_delaying) return;
  minmax_delaying= true;
  window.setTimeout(minmax_layout, 0);
}

function minmax_stopdelaying() {
  minmax_delaying= false;
}

function minmax_layout() {
  window.setTimeout(minmax_stopdelaying, 100);
  var i, el, st, cs, optimal, inrange;
  for (i= minmax_elements.length; i-->0;) {
    el= minmax_elements[i]; st= el.style; cs= el.currentStyle;

    // horizontal size bounding
    st.width= st.minmaxWidth; optimal= el.offsetWidth;
    inrange= true;
    if (inrange && cs.minWidth && cs.minWidth!='0' && cs.minWidth!='auto' && cs.minWidth!='') {
      st.width= cs.minWidth;
      inrange= (el.offsetWidth<optimal);
    }
    if (inrange && cs.maxWidth && cs.maxWidth!='none' && cs.maxWidth!='auto' && cs.maxWidth!='') {
      st.width= cs.maxWidth;
      inrange= (el.offsetWidth>optimal);
    }
    if (inrange) st.width= st.minmaxWidth;

    // vertical size bounding
    st.height= st.minmaxHeight; optimal= el.offsetHeight;
    inrange= true;
    if (inrange && cs.minHeight && cs.minHeight!='0' && cs.minHeight!='auto' && cs.minHeight!='') {
      st.height= cs.minHeight;
      inrange= (el.offsetHeight<optimal);
    }
    if (inrange && cs.maxHeight && cs.maxHeight!='none' && cs.maxHeight!='auto' && cs.maxHeight!='') {
      st.height= cs.maxHeight;
      inrange= (el.offsetHeight>optimal);
    }
    if (inrange) st.height= st.minmaxHeight;
  }
}

// Scanning. Check document every so often until it has finished loading. Do
// nothing until <body> arrives, then call main init. Pass any new elements
// found on each scan to be bound   

var minmax_SCANDELAY= 500;

function minmax_scan() {
  var el;
  for (var i= 0; i<document.all.length; i++) {
    el= document.all[i];
    if (!el.minmax_bound) {
      el.minmax_bound= true;
      minmax_bind(el);
  } }
}

var minmax_scanner;
function minmax_stop() {
  window.clearInterval(minmax_scanner);
  minmax_scan();
}

minmax_scan();
minmax_scanner= window.setInterval(minmax_scan, minmax_SCANDELAY);
AE_AttachEvent("onload", "minmax_stop");

@end @*/

// ]]>