header('Content-type: text/javascript'); ?>
var origWidth = echo intval($_GET['w']); ?>;
var origHeight = echo intval($_GET['h']); ?>;
var atBottom = true;
var sxsw = {
full_bleed: function(boxWidth, boxHeight, imgWidth, imgHeight) {
// Calculate new height and width...
var initW = imgWidth;
var initH = imgHeight;
var ratio = initH / initW;
imgWidth = boxWidth;
imgHeight = boxWidth * ratio;
// If the video is not the right height, then make it so...
if(imgHeight < boxHeight){
imgHeight = boxHeight;
imgWidth = imgHeight / ratio;
}
// Return new size for video
return {
width: imgWidth,
height: imgHeight
};
},
init: function() {
var browserHeight = 0;
var browserWidth = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
browserWidth = window.innerWidth;
browserHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
browserWidth = document.documentElement.clientWidth;
browserHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
browserWidth = document.body.clientWidth;
browserHeight = document.body.clientHeight;
}
//Does not work in FF: origHeight = jQuery('#background').height();
//Does not work in FF: origWidth = jQuery('#background').width();
var videoHeight = origHeight;
var videoWidth = origWidth;
var new_size = sxsw.full_bleed(browserWidth, browserHeight, videoWidth, videoHeight);
jQuery('#background')
.width(new_size.width)
.height(new_size.height);
var ratioX = browserWidth / origWidth;
var ratioY = browserHeight / origHeight;
if (ratioY * origWidth >= browserWidth) // Cropped horizontally
{
$('#background').css('marginTop', 0);
$('#background').css('marginLeft', (browserWidth - (ratioY * origWidth)) / 2);
}
else if (ratioX * origHeight >= browserHeight) // Cropped vertically
{
$('#background').css('marginTop', (browserHeight - (ratioX * origHeight)) / 2);
$('#background').css('marginLeft', 0);
}
}
};
jQuery(document).ready(function($) {
hideAll();
$('#home_sub_news').show();
/*
* Full bleed background
*/
sxsw.init();
$(window).resize(function() {
var browserHeight = 0;
var browserWidth = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
browserWidth = window.innerWidth;
browserHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
browserWidth = document.documentElement.clientWidth;
browserHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
browserWidth = document.body.clientWidth;
browserHeight = document.body.clientHeight;
}
var videoHeight = origHeight;//$('.wd-thumb-list li a').eq(0).attr('data-wd-height');
var videoWidth = origWidth;//$('.wd-thumb-list li a').eq(0).attr('data-wd-width');
var new_size = sxsw.full_bleed(browserWidth, browserHeight, videoWidth, videoHeight);
$('#background')
.width(new_size.width)
.height(new_size.height);
var ratioX = browserWidth / origWidth;
var ratioY = browserHeight / origHeight;
if (ratioY * origWidth >= browserWidth) // Cropped horizontally
{
$('#background').css('marginTop', 0);
$('#background').css('marginLeft', (browserWidth - (ratioY * origWidth)) / 2);
}
else if (ratioX * origHeight >= browserHeight) // Cropped vertically
{
$('#background').css('marginTop', (browserHeight - (ratioX * origHeight)) / 2);
$('#background').css('marginLeft', 0);
}
});
});
function changeBack(srcUrl)
{
$('#background').replaceWith(createImageTag(srcUrl));
$(window).resize();
}
function displayBackgroundVideo(srcUrl)
{
var imgUrl = srcUrl.replace('.mp4', '.png');
$('#background').replaceWith(createVideoTag(srcUrl, imgUrl));
$('#background').bind('ended', function(){ changeBack(imgUrl) });
$('#background').bind('pause', function(){ changeBack(imgUrl) });
$(window).resize();
}
function createImageTag(srcUrl)
{
var tagContents = '
';
return tagContents;
}
function createVideoTag(srcUrl, imgUrl)
{
var tagContents =
'';
return tagContents;
}
function changeHomeMenu(homeSubName)
{
hideAll();
$('#home_sub_' + homeSubName).show();
$('#home_sub_' + homeSubName + '2').show();
$('#home_sub_' + homeSubName + '3').show();
}
function changeHover()
{
$('#hover_box').show();
}
function changeHover2()
{
$('#hover_box').hide();
}
function changeHomeSubMenu(homeSub2Name)
{
hideAllSubMenus();
$('#home_sub2_' + homeSub2Name).show();
$('#home_sub2_' + homeSub2Name + '2').show();
$('#home_sub2_' + homeSub2Name + '3').show();
}
function hideAllSubMenus()
{
$('#home_sub2_realistic').hide();
$('#home_sub2_abstract').hide();
$('#home_sub2_interiorreal').hide();
$('#home_sub2_landscape').hide();
$('#home_sub2_company').hide();
$('#home_sub2_people').hide();
$('#home_sub2_people2').hide();
$('#home_sub2_contact').hide();
$('#home_sub2_contact2').hide();
$('#home_sub2_clients').hide();
}
function hideAll()
{
if (atBottom)
{
$('#move_down').hide();
}
hideAllSubMenus();
$('#home_sub_news').hide();
$('#home_sub_artist_impressions').hide();
$('#home_sub_animations').hide();
$('#home_sub_animations2').hide();
$('#home_sub_animations3').hide();
$('#home_sub_interactives').hide();
$('#home_sub_interactives2').hide();
$('#home_sub_studioVUUR').hide();
$('#hover_box').hide();
}
function toggleMenuBar()
{
if (atBottom)
{
$('#move_up').hide();
$('#move_down').show();
$('div.menubar').css('top', '20%');
$('div.logo').css('top', '20%');
$('div.home_sub').css('top', '20%');
$('div.home_sub_news').css('top', '20%');
$('div.home_sub_menu').css('top', '20%');
$('div.home_sub_list').css('top', '19%');
$('div.home_sub_list2').css('top', '19%');
$('div.home_sub_list3').css('top', '19%');
$('div.home_sub_list4').css('top', '19%');
$('div.home_sub_list5').css('top', '19%');
$('div.home_sub_list6').css('top', '19%');
$('div.home_sub2_menu').css('top', '20%');
$('div.home_sub2_menu2').css('top', '20%');
atBottom = false;
}
else
{
$('#move_up').show();
$('#move_down').hide();
$('div.menubar').css('top', '65%');
$('div.logo').css('top', '65%');
$('div.home_sub').css('top', '65%');
$('div.home_sub_news').css('top', '65%');
$('div.home_sub_menu').css('top', '65%');
$('div.home_sub_list').css('top', '64%');
$('div.home_sub_list2').css('top', '64%');
$('div.home_sub_list3').css('top', '64%');
$('div.home_sub_list4').css('top', '64%');
$('div.home_sub_list5').css('top', '64%');
$('div.home_sub_list6').css('top', '64%');
$('div.home_sub2_menu').css('top', '65%');
$('div.home_sub2_menu2').css('top', '65%');
atBottom = true;
}
}