
var IframePubPosition;
var IframePubPositionSuivante;

function refreshIframePub( position ){
	
	if( position && position != "" ){
		reg = new RegExp( ",", "g" );
		positions = position . split( reg );

		positionSuivantes = "";
		for( i = 1; i < positions . length; i++ ){
			
			if( ( document . getElementById( 'contenuPubOAS-' + positions[i] ) + "" ) != "null" ){
				if( positionSuivantes != "" ){
					positionSuivantes += ",";
				}
				positionSuivantes += positions[i];
			}
		}
		
		IframePubPosition = positions[ 0 ];
		IframePubPositionSuivante = positionSuivantes;
		 
		pub = "http://memorix.sdv.fr/2/" + 
			OAS_sitepage + "/" + ( Math . round( Math . random() * 1000 ) ) + "@" + IframePubPosition;
		
		url = "/ajax/ajax_pub_iframe.php?url=" + encodeURI( pub );
		
		document . getElementById( 'iframePub' ) . src = url;
	}
}

function setIframePubPosition(){
	if( IframePubPosition ){
		if( IframePubPosition != "" ){
			if( ( document . getElementById( 'contenuPubOAS-' + IframePubPosition ) + "" ) != "null" ){
				document . getElementById( 'contenuPubOAS-' + IframePubPosition ) . innerHTML = 
					document . getElementById( 'iframePub' ) . contentWindow . document . body . innerHTML;
			}	
			refreshIframePub(IframePubPositionSuivante);
		}
	}
}

