function IssuuPreview(doc,id) {
	document.write('<object style="width:333px;height:230px">');
		document.write('<param name="movie" value="http://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf?mode=preview&amp;previewLayout=white&amp;username=infociments&amp;docName='+doc+'&amp;documentId='+id+'&amp;autoFlip=true&amp;backgroundColor=ffffff&amp;layout=grey" />');
		document.write('<param name="allowScriptAccess" value="always" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<embed');
		    document.write(' src="http://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf"');
			document.write(' type="application/x-shockwave-flash"');
			document.write(' wmode="transparent"');
			document.write(' allowscriptaccess="always"');
			document.write(' style="width:333px;height:230px"');
			document.write(' flashvars="mode=preview&amp;previewLayout=white&amp;username=infociments&amp;docName='+doc+'&amp;documentId='+id+'&amp;autoFlip=true&amp;backgroundColor=ffffff&amp;layout=grey"');
		document.write('/>');
	document.write('</object>');
}

var pageParam = GetPageParameter();
function CloseIssuuFullScreen(){
    if (pageParam != null && pageParam != "") {
        window.location.href = window.location.href.substring(0, window.location.href.indexOf('/page'));
    }
    else{
        myLightWindow.deactivate();
    }
}

// affichage lightwinwow onload lorsque lightwinwow est prêt
if (pageParam != null && pageParam != "") {
    var interval = setInterval("ActivateLightBox()",400);
}
else {
    if(window.location.href.indexOf('/page/') > -1)
        window.location.href = window.location.href.substring(0,window.location.href.indexOf('/page/'));
}

function ActivateLightBox(){
    if (myLightWindow != null && myLightWindow != "undefined" && myLightWindow) {
        clearInterval(interval);
        myLightWindow.activate(document.getElementById('LightBoxLink'),document.getElementById('LightBoxLink'));
    }
}

function GetPageParameter(){
  var regex = new RegExp("/page/(.*)");
  var results = regex.exec(window.location.href);
  return (results == null || results[1] == null) ? null : results[1];
}
