function copyToClip(myId) {
	document.getElementById(myId).focus(); document.getElementById(myId).select(); 
	myData = document.getElementById(myId).value;

	if(window.clipboardData) { clipboardData.setData('Text',myData); }
	else { alert(ieOnly); return false;}
}

function selectText(myId){ document.getElementById(myId).focus(); document.getElementById(myId).select(); }

/**
 * Function for focusing and selecting textarea for the banners
 * in the promotionlist using DOM traversal
 * @author Jan Ranier Ramos
 * @param btnElem button
 * @return
 */
function domSelectText(btnElem){
	/**
	 * The following code (commented) is a native DOM method 
	 * for focusing the textarea and selecting the value.
	 * Native methods works faster but may have compatibility
	 * issues with other browsers.
	 */
	//btnElem.parentNode.getElementsByTagName('textarea').item(0).focus(); 
	//btnElem.parentNode.getElementsByTagName('textarea').item(0).select(); 
	/**
	 * The following code on the otherhand used jQuery (selector
	 * for DOM traversal) that wraps native DOM methods depending
	 * on the browser. This can be a bit slower but ensures
	 * compatibility across multiple browsers. 
	 */
	jQuery(btnElem).parent().children('textarea').focus();
	jQuery(btnElem).parent().children('textarea').select();
}

/**
 * Function for focusing and selecting textarea as well as
 * copying the content of the textarea to the client's clipboard
 * @author Jan Ranier Ramos
 * @param btnElem button
 * @return
 */
function domCopyToClip(btnElem) {
	domSelectText(btnElem);
	myData = jQuery(btnElem).parent().children('textarea').val();
	if(window.clipboardData) { clipboardData.setData('Text',myData); }
	else { alert(ieOnly); return false;}
}

function popUp(link,w,h) {
  newWin = window.open(link,'newWin', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+', top=100, left=300');
  return false;
}

function windowPopup(url)
{
	// replace '&amp;' by '&'
	url = url.replace(/\&amp;/g, '&');
	
	// open popup
	var win = window.open(url, 'popup');
	
	// popup blocked
	if (!win)
	{
		// display message
		var message = (typeof(langPopupBlockerTurnOff) == 'undefined')  ? 'Turn off your popup blocker please' : langPopupBlockerTurnOff;
		alert(message);
		return;
	}
	
	// focus popup
	win.focus();
}

window.onload = function() {
	if (document.all) {
		links = document.getElementById('topmenu').getElementsByTagName('a');
		for (var i=0;i<links.length;i++) {
			if (links[i].nextSibling && links[i].id != 'home') {
                   ifr = document.createElement('iframe');
				ifr.style.height = links[i].nextSibling.offsetHeight + 'px';
				links[i].appendChild(ifr);
			};
		}
	}

	if (document.getElementById('filters1')) {
		el = document.getElementById('filters1');
		dt = el.getElementsByTagName("dt");
		for(var i=0;i<dt.length;i++){
			el = dt[i].getElementsByTagName('input')[0];
			if (el.value == 3)  {
            	el.onclick = function() {
					document.getElementById('view').value = 'year';
				}
			} else {
	    	    el.onclick = function() {
					document.getElementById('view').value = 'month';
				}
			}
		}
	}

}