$(document).ready(function(){
// cargamos el primer proyecto a mostrar
loadFirstProject();
$('.cover-toleft').mosaic({
animation : 'slide', //fade or slide
hover_x : '400px' //Horizontal position on hover
});
});
function loadFirstProject() {
// cargamos la imagen del proyecto actual y sus datos
resizeElementsSCut();
// conseguimos el imageSource del array:
//var imageSource = getImageSourceActual();
preloadImage(loadFirstProjectEnd);
}
function loadFirstProjectEnd() {
//var imageSource = getImageSourceActual();
//$(imgCenter)[0].src = imageSource;
resizeImageSCut();
$('#slider').css({opacity:0}).fadeTo(1000, 1);
if (!isIE) {
projects[projectActual][7] = true;
}
$('#project_tapa').stop().fadeOut('slow');
}
//function getImageSourceActual(){
// var idImage = projects[projectActual][6].split('|')[imageActual-1];
// var imageSource = imagePath+idImage+".jpg";
// return imageSource;
//}
$(window).resize(function(){
// gestión del resize de la ventana
resizeImageSCut();
});
function resizeImageSCut() {
// resize de las imágenes de fondo para encajar en pantalla
// ratio proporcional de la ventana del navegador
var navWidth = $(window).width();
var navHeight = $(window).height();
var navRatio = navWidth / navHeight;
var viewportwidth;
var viewportheight;
var viewportratio = viewportwidth / viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined')
{
viewportwidth = window.innerWidth,
viewportheight = window.innerHeight
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0)
{
viewportwidth = document.documentElement.clientWidth,
viewportheight = document.documentElement.clientHeight
}
// older versions of IE
else
{
viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
viewportheight = document.getElementsByTagName('body')[0].clientHeight
}
// ratio proporcional de la imagen
if ($('#main_image').width() > 1) picWidth = $('#main_image').width();
if ($('#main_image').height() > 1) picHeight = $('#main_image').height();
picRatio = picWidth / picHeight;
// escala resultante
if (navRatio > picRatio) {
// escalamos la imagen para ajustarse al ancho del navegador
var newHeight = (navWidth / picWidth) * picHeight;
var newWidth = navWidth;
} else {
// escalamos la imagen para ajustarse a la altura del navegador
var newHeight = navHeight;
var newWidth = (navHeight / picHeight) * picWidth;
}
// centramos la imagen
newTop = 0 - ((newHeight - navHeight) / 2);
newLeft = 0 - ((newWidth - navWidth) / 2);
// colocamos todas
$('#slider').css({height: navHeight, width: navWidth});
$('#slider').css({visibility:"visible", display:"block"});
$('.main_image, #text').css({height: newHeight, width: newWidth, left: newLeft, display:"block"});
$('#text .video, #text .listtvc').css({height: viewportheight});
$('#adjust').css({height: viewportheight, width: newWidth, left: newLeft});
resizeElementsSCut();
}
function resizeElementsSCut() {
var navWidth = $(window).width();
var navHeight = $(window).height();
// también centramos la precarga
//var preloadTop = (navHeight-40)/2;
//var preloadLeft = (navWidth-40)/2;
//$('#project_preload').css({top: preloadTop, left: preloadLeft});
}
function preloadImage(source, nextEvent) {
// tapamos y precargamos una imagen
// if (isIE) $(this).oneTime(50, "preload", nextEvent);
// else {
$('#project_tapa').show();
if (imageActual!=1 || !projects[projectActual][7]){
$('').attr('src', source).load(function(){
// ocultamos la precarga y mostramos
if (imageActual==1) projects[projectActual][7] = true;
//$('#project_tapa').stop().fadeOut('slow');
$(this).oneTime(500, "preload", nextEvent);
});
} else {
//$('#project_tapa').stop().fadeOut('slow');
$(this).oneTime(250, "preload", nextEvent);
}
//}
}
$(document).ready(function() {
//signbox jika dibutuhkan
// Hide the "view" div.
$('span.signbox').hide();
// Watch for clicks on the "slide" link.
$('li.signin').click(function() {
// When clicked, toggle the "view" div.
$('span.signbox').slideToggle(400);
return false;
});
//resizer homepage dan landingpage
var $winwidths = document.documentElement.clientWidth ;
$("div#zero").css("width", $winwidths
);
$(window).bind("resize", function(){
var $winwidths = document.documentElement.clientWidth ;
$("div#zero").css("width", $winwidths
);
});
var $winheights = document.documentElement.clientHeight ;
$("div#contents").css("height", $winheights - 112
);
$(window).bind("resize", function(){
var $winheights = document.documentElement.clientHeight ;
$("div#contents").css("height", $winheights - 112
);
});
//tvc loading
$(function() {
$( "#tvc" ).tabs({ fx: { opacity: 'toggle' } });
});
//tabs single
$(function() {
$( "#tabsingle" ).tabs({ fx: { opacity: 'toggle' } });
});
//tabs single ancestor
$(function() {
$( "#tabsingleancestor" ).tabs({ fx: { opacity: 'toggle' } });
});
// Hide the "view" div.
$('div#footmenu #wrapper').hide();
// Watch for clicks on the "slide" link.
$('span#entersite').click(function() {
// When clicked, toggle the "view" div.
$('div#footmenu #wrapper').slideToggle(400);
return false;
});
Cufon.replace('h1,#smallbanner span#titlebanner,#smallbanner h2', { fontFamily: 'Matiz' });
Cufon.replace('#cufon');
//$("span#cufon,div.nav li a").textShadow();
$("#wrapper ul#menu").find("li").eq(1).after("