/*--------------Holdlink()---------------*/
function holdlink(menu_id, sub_menu_id){
	if(menu_id=='home'){
		document.getElementById(menu_id).style.display='none';
	} else if(menu_id=='resources'){
		document.getElementById(menu_id).className='current';
		if(sub_menu_id!='')
		document.getElementById(sub_menu_id).className='current';
	} else
	document.getElementById(menu_id).className='current';
}
/*--------------Holdlink()---------------*/

/*--------------------------popup() ----------------------------*/
function drawing()
{

	var NewWin3;
	NewWin3=window.open("drawing.htm",'NewWin1','height=595,width=534,top=10,left=150,location=no,status=no,toolbar=no,menubar=no,scrollbars=no');
	NewWin3.focus();
}
function redeem(url_redeem)
{
	
	var NewWin4;
	NewWin4=window.open(url_redeem,'NewWin1','height=387,width=600,top=10,left=150,location=no,status=no,toolbar=no,menubar=no,scrollbars=no');
	NewWin4.focus();
}
/*--------------------------consultation() ----------------------------*/

/*PNG FIX*/
function fixPNG(){
	if(navigator.appName=='Microsoft Internet Explorer' && navigator.appVersion.indexOf('MSIE 6.0')>=0){
		var all_div=document.getElementsByTagName('div');
		div_len=all_div.length;
		for(var i=0; i<div_len;i++) {
			//alert(all_div[i].id);
			if(all_div[i].id!="") {
				if(all_div[i].style.background!="" && all_div[i].style.background.indexOf('.png')>=0) {
					 //alert(all_div[i].style.background);
					 var obj = all_div[i];
					 //alert(obj.style);
					 var bg  = obj.currentStyle.backgroundImage;
					 var src = bg.substring(5,bg.length-2);
					 var sizingMethod = (obj.currentStyle.backgroundRepeat == "no-repeat") ? "crop" : "scale";
					 obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')";
					 obj.style.backgroundImage = "url(path/to/transparent.gif)";
				}
			}
		}
		var all_div=document.getElementsByTagName('img');
		div_len=all_div.length;
		for(var i=0; i<div_len;i++) {
			//alert(all_div[i].id);
			if(all_div[i].id!="") {
				if(all_div[i].src!="" && all_div[i].src.indexOf('.png')>=0) {
					 //alert(all_div[i].style.background);
					 var obj = all_div[i];
					 //alert(obj.style);
					 var bg  = obj.src;
					 var src = bg.substring(5,bg.length-2);
					 var sizingMethod = (obj.currentStyle.backgroundRepeat == "no-repeat") ? "crop" : "scale";
					 obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')";
					 obj.style.backgroundImage = "url(path/to/transparent.gif)";
				}
			}
		}
	}
}
/*PNG FIX*/

/*------------include function---------------------*/
function include_file(id, url) {
	
	
  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 var element = document.getElementById(id);
  if (req) {
    // Synchronous request, wait till we have it all
	req.open('GET', url, false);
    req.send(null);
    
	if(id=="topHeader") {
		if(typeof(page_name)=="undefined") 
			page_name="";
		element.innerHTML = req.responseText.replace(/\[PAGENAME\]/g,page_name);		
	} else {
		element.innerHTML = req.responseText;	
	}
  } 
}

function processPayment() {
	document.getElementById('submit_Payment').disabled="yes";
	document.getElementById('edit_information').disabled="yes";
	var pagesize = getPageSize();
	document.getElementById('shadowLayer').style.top=0;
	document.getElementById('shadowLayer').style.left=0;
	document.getElementById('shadowLayer').style.width=pagesize[0]+"px";
	document.getElementById('shadowLayer').style.height=pagesize[1]+"px";
	document.getElementById('shadowLayer').style.background="#000000";
	document.getElementById('shadowLayer').style.display="";
	
	document.getElementById('processingBox').style.top=0;
	document.getElementById('processingBox').style.left=0;
	document.getElementById('processingBox').style.border='4px solid #c9c9c9';
	document.getElementById('processingBox').style.background='#FFFFFF';
	document.getElementById('processingBox').style.top = "40%";	
	document.getElementById('processingBox').style.left = ((pagesize[0]-400)/2)+'px';
	document.getElementById('processingBox').style.display="";
}
function getPageSize(){
var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
	//	console.log(self.innerWidth);
	//	console.log(document.documentElement.clientWidth);
	
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
	//	console.log("xScroll " + xScroll)
	//	console.log("windowWidth " + windowWidth)
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}
	//	console.log("pageWidth " + pageWidth)
	
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return arrayPageSize;
}
/*------------include function---------------------*/
