/*########################################################################*\

	Developed by 		: © Maximum
	Version				: 1.0.0
	Creation Date		: 2/7/06
	Modification Date	: 2/7/06
	Creation by			: Jerry van Heerikhuize
	Modification by		: Jerry van Heerikhuize
	Description			: write a button
	File				: common.js
	ID					: 26F9AAB4-95B0-400D-ABE9-037561E8AAB7

\*########################################################################*/

writeButton = function (type, text, url){
				
	switch (type){
	
		default: 
			
			var str = '<table class="c-button" cellspacing="0">';
		
			break;
			
		case "action":
			
			var str = '<table class="c-button-action" cellspacing="0">';
			
			break;
			
		case "disabled":
		
			var str = '<table class="c-button-disabled" cellspacing="0">';
			
			break;
		
	}

	str += '<tr>';
	str += '<td onclick="' + url + '">';
	str += '<div>' + text + '</div>';
	str += '</td>';
	str += '</tr>';
	str += '</table>';
	
	document.write (str);

}

/*########################################################################*\

	Example :

	writeButton ("default", "Button", "http://www.apple.com");
	writeButton ("action", "Button", "http://www.apple.com");
	writeButton ("disabled", "Button", "http://www.apple.com");

\*########################################################################*/

/*########################################################################*\
	After loading the page in the iFrame, adjust the size based on the height of the content
/*########################################################################*/

function adjustIFrameSize () {
	
	
	var minHeight = 420;
	
	iframeWindow = window.parent.frames['iframeTemplate']	
	
  if (iframeWindow.document.height) {
    var iframeElement = parent.document.getElementById(iframeWindow.name);
    if (iframeWindow.document.height > minHeight){
	    iframeElement.style.height = iframeWindow.document.height +  'px';
    } else {
	    
	    iframeElement.style.height = minHeight + 'px';
    }
  }
  else if (document.all) {
    var iframeElement = parent.document.all[iframeWindow.name];
    if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
    {
	    if (iframeWindow.document.documentElement.scrollHeight > minHeight){
	      iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 'px';
	    } else {
		    
		    iframeElement.style.height = minHeight + 'px';
	    }
    }
    else {
	    if (iframeWindow.document.body.scrollHeight > minHeight){
	      iframeElement.style.height = iframeWindow.document.body.scrollHeight + 5 + 'px';
	    } else {
		    
		    iframeElement.style.height = minHeight + 'px';
	    }
    }
  }
}
