function checkIntegerValue(element){
	val=parseInt(element.value);
	if(element.value!=""){
		if(isNaN(val)){
			val=0;
		}
		element.value=val;
	}
}

function openLinkInNewWindow(link){
	if(link.toLowerCase().indexOf("http://")==-1){
		link = "http://"+link;
	}
	window.open(link,"_blank");
}

function popup(page,width,height,text) {
    window.open(page,'_blank','toolbar=no,screenX=150,screenY=30,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+ width +',height='+ height);
    
}

function newWin(url) {
	window.open(url, '_blank');
	return false;
}

function newWinForm(element) {
	element.target="_blank";
	element.submit();
}

function togleVisibility(element){
	if(element.style.display=="block"){
		element.style.display="none";
	}
	else{
		element.style.display="block";
	}
}

function switchCheckboxValue(id){
	document.getElementById(id).checked==true?document.getElementById(id).checked=false:document.getElementById(id).checked=true;
}

function bookmarkLink() {
 	title = document.title; 
 	url = location.href;
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
 
 function adClick(url,ad_id,ad_type_id) {
	document.location="adclick.php?ad_id="+ad_id+"&ad_type_id="+ad_type_id+"&url="+url;
	return false;
}
 