/* istruzioni
id: id portale
idLang: id lingua
sezione: dart site
attivo: 0 = presente, 1 = non presente
seTypo: 0 = dart, 1 = housebarter,
width: larghezza
height: altezza
type: 0 = full 468x60, 1 = button 120x90, 2 = button 120x60 tile=1, 3 = button 120x60 tile=2, 4 = full 468x60 ricerca
*/

function expandit(which){
		if (which.style.overflow == "visible") {
		 which.style.overflow = "hidden"
		 
		}else{
		 which.style.overflow = "visible"
		}
	}
	
function setIframeHeight(iframeName,tipo,heightbann) {
  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if ( iframeEl && iframeWin && !isMac) {
    //iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
    //var docHt = getDocHeight(iframeWin.document);
    // need to add to height to be sure it will all show
    //if (docHt) iframeEl.style.height = docHt + 30 + "px";
	if (tipo != 1){
		iframeEl.style.height = heightbann + "px"
	}else{
		var docHt = getDocHeight(iframeWin.document);
    	// need to add to height to be sure it will all show
    	if (docHt) iframeEl.style.height = docHt-4 + "px";
  		}
  	}
}

function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

var lang;
function bannersVis(id,idLang,sezione,attivo,width,height,type){
    adsite = sezione.substring(sezione.indexOf(".")+1,sezione.indexOf("/")).toUpperCase();
	switch (idLang){
		case "1":
			lang = "ITA";
		break;
		case "2":
			lang = "ENG";
		break;
		case "3":
			lang = "ESP";
		break;
		case "4":
			lang = "FRA";
		break;
		case "5":
			lang = "GER";
		break;
		default:
			lang = "ITA";
	}
	




	
	if (setVisibility(type)){
		if (setTypo == 0){
		
			now = new Date();
			random = now.getTime();
			site = "http://wayin.adbureau.net";
			target = "/SITE="+adsite+"/AREA="+lang+"/AAMSZ="+width+"X"+height+"";
			document.write('<IFRAME SRC="' + site + '/hserver/acc_random=' + random + target + '"');
			document.write(' NORESIZE SCROLLING=NO HSPACE=0 VSPACE=0 FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 WIDTH='+width+' HEIGHT='+height+'>');
			document.write('<SCR');
			document.write('IPT SRC="' + site + '/jnserver/acc_random=' + random + target + '">');
			document.write('</SCR');
			document.write('IPT>');
			document.write('</IFRAME>');				
		}
		if (setTypo == 1){
			site = "http://dart.wayin.net/clickthrough/loadbann.asp"
			//site = "/ads/clickthrough/loadbann.asp";
			parametri ="?idsite="+id;
			parametri = parametri+"&widthP="+width+"&heightP="+height+"&typeP="+type;
			//document.write(site+parametri)
			if (!isMac){
				document.write(' <div style="position:relative;top:0px; left:0px;width:'+width+'px; height:'+height+'px;')
				if (type == 0){
					document.write('z-index:2')
				}
				document.write('"><div style="position:absolute; top:0px; left:0px; width:'+width+'px; height:'+height+'px; overflow:hidden;');
		 		if (type == 0){
					document.write(' z-index:2')
				}
				document.write('"')
				document.write(' onmouseover="expandit(this)" onmouseout="expandit(this)">');
				document.write(' <IFRAME id="bann'+type+'" SRC="' + site + parametri + '" ');
				document.write(' NORESIZE SCROLLING=NO HSPACE=0 VSPACE=0 FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 WIDTH='+width+' HEIGHT='+height+'>');
				document.write('</IFRAME></div></div>');	
			}else{
				document.write(' <IFRAME id="bann'+type+'" SRC="' + site + parametri + '" ');
				document.write(' NORESIZE SCROLLING=NO HSPACE=0 VSPACE=0 FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 WIDTH='+width+' HEIGHT='+height+'>');
				document.write('</IFRAME>')
			}	
		}
	}

}






