// Creates a instance of the Image structure function createImageObj( imgObj, hrefPD, showSmall, showFirst, fromURL) { imgObj.hasPhoto = false; imgObj.hasVideo = false; imgObj.hasYoutube = false; imgObj.hrefPD = hrefPD; imgObj.showSmall = ( showSmall === 'true' ); if ( fromURL === 'true' ) { if ( showFirst != '' ) imgObj.showFirst = showFirst; else imgObj.showFirst = 'p'; } else imgObj.showFirst = 'p'; imgObj.photoHTML = ""; imgObj.videoHTML = ""; imgObj.youtubeHTML = ""; if ( imgObj.showSmall ) { imgObj.w = '56'; imgObj.h = '42'; imgObj.video = 'http://contentcache.awarenessnetworks.com/site/fairmont/images/overlay-video-small.png'; imgObj.youtube = 'http://contentcache.awarenessnetworks.com/site/fairmont/images/overlay-youtube-small.png'; } else { imgObj.w = '70'; imgObj.h = '55'; imgObj.video = 'http://contentcache.awarenessnetworks.com/site/fairmont/images/overlay-video.png'; imgObj.youtube = 'http://contentcache.awarenessnetworks.com/site/fairmont/images/overlay-youtube.png'; } } // Fill the HTML for the first asset ( photo or Video ) function initPhotoVideo( imageObj, mediaType, assetURL, assetName ){ if ( mediaType == 'Image' ) { imageObj.hasPhoto = true; if ( imageObj.showSmall ) imageObj.photoHTML = '
' + assetName + '
'; else imageObj.photoHTML = '
' + assetName + '
'; } else if ( mediaType == 'Video' ) { imageObj.hasVideo = true; var vidLink = assetURL; var thumbLink = vidLink.replace(/\.flv$/gi, ".jpg"); if ( imageObj.showSmall ) imageObj.videoHTML = '
Video Thumb
'; else imageObj.videoHTML = '
Video Thumb
'; } } // Fill the HTML for the first Asset ( youtube ) function initYoutube( imageObj, bookmarkURL ){ if ( ( !imageObj.hasPhoto && !imageObj.hasVideo ) || imageObj.showFirst == 'y'){ if ( bookmarkURL != '' ){ imageObj.hasYoutube = true; var results = bookmarkURL.match('http://www\.youtube\.com/v/([a-zA-Z0-9_]+)&.*'); if ( results === null) var results = bookmarkURL.match("[\\?&]v=([^&#]*)"); var vid = ( results === null ) ? '' : results[1]; if ( imageObj.showSmall ) imageObj.youtubeHTML = '
Video Thumb
'; else imageObj.youtubeHTML = '
Video Thumb
'; } } } // Display the image according the order function displayImage( imageObj ){ switch ( imageObj.showFirst ) { case 'a': case 'p': case '': if ( imageObj.hasPhoto ) document.write( imageObj.photoHTML ); else if ( imageObj.hasVideo ) document.write( imageObj.videoHTML ); else if ( imageObj.hasYoutube ) document.write( imageObj.youtubeHTML ); else { if ( imageObj.showSmall ) document.write( '
' ); else document.write( '
' ); } break; case 'v': if ( imageObj.hasVideo ) document.write( imageObj.videoHTML ); else if ( imageObj.hasYoutube ) document.write( imageObj.youtubeHTML ); else { if ( imageObj.showSmall ) document.write( '
' ); else document.write( '
' ); } break; default: if ( imageObj.hasYoutube ) document.write( imageObj.youtubeHTML ); else { if ( imageObj.showSmall ) document.write( '
' ); else document.write( '
' ); } break; } }