//includo il file js utilizzato per l'implementazione dei Flash e degli oggetti OpenLaszlo
//document.write("<script language=\"JavaScript\" type=\"text/javascript\" src=\"include/worinclude/library.js\"></script>");

function domloadedInitFunc(){
    qm_create(0,false,0,500,false,false,false,false,false);
    Shadowbox.init();
    
}

function changeImage(v_strImageBoxName,v_strImage){
    var objImageBox = document.getElementById(v_strImageBoxName);
    objImageBox.src = v_strImage;
}

function showImageAux(imageurl){
	showImage(imageurl);
}
function showImage(imageurl, stitle){
	Shadowbox.open({player:'img', title: stitle, content: imageurl});
}
function showText(stext, stitle){
	Shadowbox.open({player:'html', title: stitle, content: stext});
}



function voidFunction(){
	//ie bug
}

function credits(){
	window.open("credits.htm","credits","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=320,height=140");
}

function getObject(v_strIdImage){
	var vObj;
	
	var strBrowserName = whatbrowser();
	
	switch(strBrowserName){
		case "NN6":
		case "NN4":{
			vObj = document.getElementById(v_strIdImage);
			break;
		}
		case "ie4":
		case "ie6":
		case "ieMac":{
			vObj = document.all(v_strIdImage);
			break;
		}
		default:{
			vObj = document.all(v_strIdImage);
		}
	}
	
	return(vObj);
}


//whatbrowser()
//
//determina con quale browser l'utente è collegato e restituisce la sigla corrispondente
//
//argomenti:
//	nessuno
//
//valore di ritorno:
//	stringa	=	sigla corrispondente al browser con cui l'utente è collegato
//				NN4	=	netscape4
//				NN6	=	netscape6
//				ie	=	internet explorer
function whatbrowser(){
	var thisbrowser = "";	//sigla del browser utilizzato dall'utente
	var strAppVersion = navigator.appVersion;

	var blnIsIe4 = (strAppVersion.indexOf("MSIE 4") == -1) ? 0 : 1;
	var blnIsIe5 = (strAppVersion.indexOf("MSIE 5") == -1) ? 0 : 1;
	var blnIsIe6 = (strAppVersion.indexOf("MSIE 6") == -1) ? 0 : 1;
	var blnIsMac = (strAppVersion.indexOf("Macintosh") == -1) ? 0 : 1;
	
	//interrogo l'oggetto document per capire quale broeser sta utilizzando l'utente
    if(document.layers){
        thisbrowser="NN4";
    }
    if(document.all){
         if(blnIsIe4 == 1 || blnIsIe5==1) thisbrowser="ie4";
         else if(blnIsIe6 == 1) thisbrowser="ie6";
         else if(blnIsMac == 1) thisbrowser="ieMac";
         else thisbrowser="ie";
         
         //alert(thisbrowser);
    }
    if(!document.all && document.getElementById){
         thisbrowser="NN6";
    }
    
    return(thisbrowser);
}

//npwidthmax()
//
//calcola width della pagina, toglie larghezza menu sinistra e larghezza menu 
//destra return (la differenza)
function npwidthmax(){
	size = parseInt(window.innerWidth) - 161;
	return size;
}


function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function OpenZoomWindow(sImg,sTitle,sWidth,sHeight){
	var oWin = window.open('','','status=0,scrollbars=0,height='+(sHeight/1+17)+'px,width='+sWidth+'px');
	var sHtml = '<html>\n';
	sHtml += '<head><title>' + sTitle + '</title>\n';
	sHtml += '<style type=\"text/css\">\n';
	sHtml += '.fntDefault { text-decoration: none; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #514C3C }\n';
	sHtml += '</style>\n</head>\n';
	sHtml += '<body bgcolor=\"#ffffff\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n';
	sHtml += '<table width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n';
	sHtml += '<tr><td align=\"center\" valign=\"middle\"><img border=\"0\" src=\"'+sImg+'\"  alt=\"'+sImg+'\"></td></tr>\n';
	sHtml += '<tr height=\"2\"><td bgcolor=\"#EBEAE5\"><img src=\"img/shared/np.gif\" height=\"2\" alt=\"\"></td></tr>\n';
	sHtml += '<tr height=\"15\"><td bgcolor=\"#F8F7F1\" align=\"right\" valign=\"middle\" class=\"fntDefault\"><a class=\"fntDefault\" href=\"javascript:window.close()\">close</a>&nbsp;&nbsp;</td></tr>\n';
	sHtml += '</table>\n';
	sHtml += '</body>\n';
	sHtml += '</html>';
	oWin.document.write(sHtml);
}

function createMedia(mediaType,src,width,height,bgcolor,wmode,swliveConn,embedMovie){
    //si tratta di flash
    if (mediaType == 0){
		if (navigator.appVersion.indexOf("MSIE") != -1){
			var strContent = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
			//se non sono definiti width e height ==> non li setto
			if (width != "") strContent += 'width="' + width + '" ';
			if (height != "") strContent += 'height="' + height + '"';
			strContent += '>';
			strContent += '<param name="movie" value="'+src+'">';
			strContent += '<param name="quality" value="high">';
			strContent += '<param name="bgcolor" value="'+bgcolor+'" />';
			strContent += '<param name="wmode" value="'+wmode+'">';
			
			if (swliveConn != "") strContent += '<param name="SwLiveConnect" value="'+swliveConn+'">';
			if (embedMovie != "") strContent += '<param name="EmbedMovie" value="'+embedMovie+'">';
			
			strContent += 'Flash plug-in not installed.';
			strContent += '</object>';
			document.write(strContent);
		}else{
			document.write('<object type="application/x-shockwave-flash" data="'+src+'" ');
			
			//se non sono definiti width e height ==> non li setto
			if (width != "") document.write('width="'+width+'" ');
			if (height != "") document.write('height="'+height+'" ');
			
			document.write('wmode="'+wmode+'" bgcolor="'+bgcolor+'" ');
			
			if (swliveConn != "") document.write('SwLiveConnect="'+swliveConn+'" ');
			if (embedMovie != "") document.write('EmbedMovie="'+embedMovie+'"');
			
			document.write('>Flash plug-in not installed.</object>');
		}
	}
}

function OpenFlvVideo(strVideoUrl, strVideoImg){

    var strRandString = String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) + String.fromCharCode(97 + Math.round(Math.random() * 25)) + String.fromCharCode(97 + Math.round(Math.random() * 25)) + String.fromCharCode(97 + Math.round(Math.random() * 25));
    
    var s1 = new SWFObject('flvplayer.swf?rnd='+strRandString,'ply'+strRandString,'274','154','9','#');
    s1.addParam('allowfullscreen','true');
    s1.addParam('allowscriptaccess','always');
    s1.addParam('wmode','opaque');
    s1.addParam('flashvars','image='+ strVideoImg +'&file='+ strVideoUrl +'&skin=bekle.swf&frontcolor=ffffff&lightcolor=CC0000&controlbar=over&stretching=uniform&autostart=true');
    s1.write('videoContainer');
    
}
