jQuery.noConflict();
jQuery.fn.css = jQuery.fn.cssOriginal;
/* #On Document Ready
================================================== */
/*
Color animation jQuery-plugin
http://www.bitstorm.org/jquery/color-animation/
Copyright 2011 Edwin Martin
Released under the MIT and GPL licenses.
*/
(function(d){function i(){var b=d("script:first"),a=b.css("color"),c=false;if(/^rgba/.test(a))c=true;else try{c=a!=b.css("color","rgba(0, 0, 0, 0.5)").css("color");b.css("color",a)}catch(e){}return c}function g(b,a,c){var e="rgb"+(d.support.rgba?"a":"")+"("+parseInt(b[0]+c*(a[0]-b[0]),10)+","+parseInt(b[1]+c*(a[1]-b[1]),10)+","+parseInt(b[2]+c*(a[2]-b[2]),10);if(d.support.rgba)e+=","+(b&&a?parseFloat(b[3]+c*(a[3]-b[3])):1);e+=")";return e}function f(b){var a,c;if(a=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(b))c=
[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16),1];else if(a=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(b))c=[parseInt(a[1],16)*17,parseInt(a[2],16)*17,parseInt(a[3],16)*17,1];else if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))c=[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),1];else if(a=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(b))c=[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];return c}
d.extend(true,d,{support:{rgba:i()}});var h=["color","backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","outlineColor"];d.each(h,function(b,a){d.fx.step[a]=function(c){if(!c.init){c.a=f(d(c.elem).css(a));c.end=f(c.end);c.init=true}c.elem.style[a]=g(c.a,c.end,c.pos)}});d.fx.step.borderColor=function(b){if(!b.init)b.end=f(b.end);var a=h.slice(2,6);d.each(a,function(c,e){b.init||(b[e]={a:f(d(b.elem).css(e))});b.elem.style[e]=g(b[e].a,b.end,b.pos)});b.init=true}})(jQuery);
jQuery(document).ready(function() {
jQuery(".scalevid").fitVids();
/* Responsive Select Menu */
jQuery("#responsive-menu select").change(function() {
window.location = jQuery(this).find("option:selected").val();
});
/* INIT THE RESPONSIVE MENU HANDLING */
menuHandler();
/* NAVIGATION INITALISATION */
initNav();
/* INIT QUOTES */
jQuery('#quotes_carousel').each(function() {
initQuotes()
});
/* INIT SEARCH FIELD */
initSearchField();
/* INIT THE SITEMAP ACCORDIONS */
initSiteMaps();
/* INIT LIGHTBOX **/
initLightboxPlugin();
/* INIT THE SOCIAL BUTTONS */
initSocial();
/* TEASER ROTATOR INIT */
initTeaserRotator();
/* Twitter ROTATOR INIT */
initTwitter();
/* ACCORDION INIT */
initAccordion();
/* Lightbox INIT */
initLightboxPlugin();
/* TESTIMONIALS */
initTestimonials();
/* FADE LISTS */
listfades();
/* TABSINIT */
tabsInit();
/* INIT POPULAR ITEMS */
widgetRotator();
/* PARTNERS MIDDLE */
jQuery('.partners').each(function() {
var pa=jQuery(this);
pa.waitForImages(function() {
var ww=0;
jQuery(this).find('li').each(function() {
ww=ww+jQuery(this).outerWidth(true);
});
pa.css({'width':ww+"px",'margin':'auto'});
});
});
/* CALL AUDIO,VIDEO HTML5 PLAYER */
initAudio();
/* CALL FOOTERHANDLING */
//footerHandler();
/* CALL CONTENT ROTATORS */
jQuery('.rotator_shortcode').contentrotator();
/* BACK TO TOP HANDLER */
initGoToTop();
// Hunt for Red Divider
jQuery(".blog_subinfos").each(function(){
jQuery(this).find(".blog_subinfos_divider:last").remove();
});
jQuery(".blogdivider:last").remove();
jQuery(".sidebar .pagedivider:last").remove();
// Hunt for To Small Skills
jQuery('#optionsbtn').click(function(){
if(jQuery('#optionswrap').position().left !=0)
jQuery('#optionswrap').animate({left: "0px"}, 300 );
else
jQuery('#optionswrap').animate({left: "-182px"}, 300 );
});
jQuery('.le_a').click(function() { setColor('fa8305'); });
jQuery('.le_b').click(function() { setColor('ffa600'); });
jQuery('.le_c').click(function() { setColor('eb4d51'); });
jQuery('.le_d').click(function() { setColor('2fafd0'); });
jQuery('.le_e').click(function() { setColor('a8c906'); });
//jQuery('.le_f').click(function() { setColor('b10075'); });
jQuery('.pattern1').click(function() { jQuery('.tp-bg-act-div-container img').attr('src',"http://www.version-four.com/themeforest/alterego/wp-content/themes/alterego/images/background/blur_1.jpg"); });
jQuery('.pattern2').click(function() { jQuery('.tp-bg-act-div-container img').attr('src',"http://www.version-four.com/themeforest/alterego/wp-content/themes/alterego/images/background/blur_2.jpg"); });
jQuery('.pattern3').click(function() { jQuery('.tp-bg-act-div-container img').attr('src',"http://www.version-four.com/themeforest/alterego/wp-content/themes/alterego/images/background/blur_3.jpg"); });
jQuery('.pattern4').click(function() { jQuery('.tp-bg-act-div-container img').attr('src',"http://www.version-four.com/themeforest/alterego/wp-content/themes/alterego/images/background/blur_4.jpg"); });
jQuery('.pattern5').click(function() { jQuery('.tp-bg-act-div-container img').attr('src',"h"); });
jQuery('#colorSelector').ColorPicker({
color: '#fa8305',
onShow: function (colpkr) {
jQuery(colpkr).fadeIn(500);
return false;
},
onHide: function (colpkr) {
jQuery(colpkr).fadeOut(500);
return false;
},
onChange: function (hsb, hex, rgb) {
jQuery('#colorwechsler').data('hex',hex);
jQuery('#packme').css({'backgroundColor':'#'+hex});
},
onSubmit: function (hsb,hex,rgb) {
setColor(jQuery('#colorwechsler').data('hex'));
}
});
jQuery('#colorwechsler').click(function() {
setColor(jQuery(this).data('hex'));
jQuery('#packme').css({'backgroundColor':'#'+hex});
return false;
});
});
function setColor(hex) {
if (jQuery('#krikilink').length>0) {
jQuery("#krikilink").remove();
}
jQuery(" ", {
id : "krikilink",
rel: "stylesheet",
type: "text/css",
href: "http://www.version-four.com/themeforest/alterego/wp-content/themes/alterego/css/screen.php?maincolor="+hex
}).appendTo("head");
jQuery('#packme').css({'backgroundColor':'#'+hex});
}
//////////////////////
// INIT GO TO TOP //
/////////////////////
function initGoToTop() {
var orig_scroll_height = jQuery(".footerholder").position().top - jQuery(window).height()-200;
// fade in #top_button
jQuery(function () {
jQuery(window).scroll(function () {
if (jQuery(this).scrollTop() > 100) {
jQuery('#backtotop').addClass("showme");
} else {
jQuery('#backtotop').removeClass("showme");
}
});
// scroll body to 0px on click
jQuery('#backtotop').click(function () {
jQuery('body,html').animate({
scrollTop: 0
}, 400);
return false;
});
});
if (jQuery(window).scrollTop() > 100)
jQuery('#backtotop').addClass("showme");
}
////////////////////////
// POPULAT ITEMS INIT //
///////////////////////
function widgetRotator() {
jQuery('.widgetrotator').each(function() {
var pitems = jQuery(this);
var act = 0;
pitems.find('>ul li').each(function(i) {
var li = jQuery(this);
if (i>1) {
li.slideUp(0);
}
});
var lb = pitems.find('.widget_left');
var rb = pitems.find('.widget_right');
lb.addClass("notinuse");
rb.click(function() {
if (act+2ul li').length) {
pitems.find('>ul li:eq('+act+')').animate({'opacity':0},{duration:200,queue:false}).slideUp(200);
pitems.find('>ul li:eq('+(act+2)+')').animate({'opacity':1},{duration:200,queue:false}).slideDown(300);
act=act+1;
lb.removeClass('notinuse');
if (act+2==pitems.find('>ul li').length) rb.addClass('notinuse');
} else {
rb.addClass('notinuse');
}
return false;
});
lb.click(function() {
if (act>0) {
act=act-1;
pitems.find('>ul li:eq('+(act+2)+')').animate({'opacity':0},{duration:200,queue:false}).slideUp(200);
pitems.find('>ul li:eq('+(act)+')').animate({'opacity':1},{duration:200,queue:false}).slideDown(300);
rb.removeClass('notinuse');
if (act==0) lb.addClass('notinuse');
}
return false;
});
});
}
function initTwitter() {
jQuery(".twitter_shortcode").each(function(){
$this = jQuery(this);
$this.twitterReader({
user:$this.data("user"),
count:$this.data("count")
});
});
}
//////////////
// QUOTES //
/////////////
/*function initQuotes() {
jQuery("#quotes_carousel").each(function() {
var ca=jQuery(this);
ca.find('li').each(function(i){
var li=jQuery(this);
li.css({'position':'absolute','top':'-30px', 'opacity':0,'display':'block'});
if (i==0) {
li.addClass('selectedquote');
setTimeout(function() {
var endt = ca.height() / 2 - ca.find('.selectedquote').height() / 2;
ca.find('.selectedquote').css({'top':'40px','opacity':0}).animate({'top':endt+'px','opacity':1},{duration:700,queue:false});
setTimeout(function() {
var actli=ca.find('.selectedquote').index();
var nextli=actli+1;
if (nextli==ca.find('li').length) nextli=0;
ca.find('.selectedquote').addClass('oldquote').removeClass('selectedquote')
ca.find('li:eq('+nextli+')').addClass('selectedquote');
},10);
},1000);
}
});
setInterval(function() {
var endt = ca.height() / 2 - ca.find('.selectedquote').height() / 2;
ca.find('.oldquote').animate({'top':'50px','opacity':0},{duration:400,queue:false});
ca.find('.selectedquote').css({'top':'40px'}).animate({'top':endt+'px','opacity':1},{duration:700,queue:false});
setTimeout(function() {
var actli=ca.find('.selectedquote').index();
var nextli=actli+1;
if (nextli==ca.find('li').length) nextli=0;
ca.find('.selectedquote').addClass('oldquote').removeClass('selectedquote')
ca.find('li:eq('+nextli+')').addClass('selectedquote');
},10);
},6000);
});
}
*/
//////////////////////
// INIT ACCORDION //
/////////////////////
function initAccordion() {
jQuery('.accordion-item').each(function(i) {
var item=jQuery(this);
item.find('.togglecontent').slideUp(0);
item.find('.accordion_down, .accordionopen').click(function() {
var displ = item.find('.togglecontent').css('display');
item.closest('ul').find('.toggleswitch').each(function() {
var li = jQuery(this).closest('li');
li.find('.togglecontent').slideUp(300);
li.find('.toggleswitch').removeClass("selected");
li.removeClass('highlight');
});
if (displ=="block") {
item.find('.togglecontent').slideUp(300)
item.find('.toggleswitch').removeClass("selected");
item.removeClass('highlight');
} else {
item.find('.togglecontent').slideDown(300)
item.find('.toggleswitch').addClass("selected");
item.addClass('highlight');
}
});
});
}
//////////////////////////////////
// SEARCH PREV LI IN THE LIST //
////////////////////////////////
function searchPrevTeaser(li) {
var ul=li.closest('ul');
var item=ul.find('li:last-child');
var lix = li.index();
if (li.index() == ul.find('li:first-child').index()) lix=999;
ul.find('li').each(function() {
if (lix>jQuery(this).index() && jQuery(this).find('.pmore')) {
item=jQuery(this);
}
});
if (item.find('.pmore').length>0) {
var pd = jQuery('#portfolio_details .tochange');
pd.animate({'opacity':0},{duration:250});
setTimeout(function() {
item.find('.pmore').click();
pd.animate({'opacity':1},{duration:250});
},300);
} else {
searchPrevTeaser(item);
}
}
//////////////////////////////////
// SEARCH NEXT LI IN THE LIST //
////////////////////////////////
function searchNextTeaser(li) {
var ul=li.closest('ul');
var item=ul.find('li:first-child');
var lix = li.index();
var gotit=0;
if (li.index() == ul.find('li:last-child').index()) lix=-1;
ul.find('li').each(function() {
if (gotit==0) {
if (lix0) {
var pd = jQuery('#portfolio_details .tochange');
pd.animate({'opacity':0},{duration:250});
setTimeout(function() {
item.find('.pmore').click();
pd.animate({'opacity':1},{duration:250});
},300);
} else {
searchNextTeaser(item);
}
}
//////////////////////////////
// INIT THE TEASER ROTATOR //
//////////////////////////////
function initTeaserRotator() {
jQuery('.tp_teaser').each(function() {
var item=jQuery(this);
//item.find('ul').addClass('listfade-img');
var amount_per_page=4;
if (item.hasClass('one_per_page'))
amount_per_page=1;
else
if (item.hasClass('four_per_page'))
amount_per_page=4;
else
if (item.hasClass('two_per_page'))
amount_per_page=2;
else
if (item.hasClass('three_per_page'))
amount_per_page=3;
// SAVE SOME INFO ABOUT THE SLIDER
item.data('maxentry',item.find('ul:first >li').length);
item.data('pos',0);
item.data('step',item.find('ul:first >li:first').outerWidth(true));
var ul = item.find('ul:first');
var lbutton = item.find('.tp_teaser_left');
var rbutton = item.find('.tp_teaser_right');
var cbutton = item.find('.tp_teaser_close');
var pos = item.data('pos');
var maxentry = item.data('maxentry');
item.data('step',item.find('ul:first >li:first').outerWidth(true));
var step = item.data('step');
ul.stop();
ul.cssAnimate({'left':(0-(pos*step))+"px"},{duration:300,queue:false});
// IF WINDOW IS RESIZED, THEN SLIDES NEED TO BE MOVED INTO THE RIGHT POSITION
jQuery(window).resize(function() {
clearTimeout(item.data('resized'));
item.data('resized',setTimeout(function() {
var pos = item.data('pos');
var maxentry = item.data('maxentry');
item.data('step',item.find('ul:first >li:first').outerWidth(true));
var step = item.data('step');
ul.stop();
if (pos==maxentry-1) pos=pos-1;
if (pos<0) pos=0;
ul.cssAnimate({'left':(0-(pos*step))+"px"},{duration:300,queue:false});
rbutton.removeClass('notinuse');
},200));
});
item.find('.tp_teaser_rotator li').hover(function() {
jQuery(this).find('.fullcover').height(jQuery(this).find('img:first').height());
});
var pd = jQuery('#portfolio_details');
lbutton.click(function() {
if (pd.css('display') != 'block') {
var pos = item.data('pos');
var maxentry = item.data('maxentry');
var step = item.data('step');
pos = pos - 1;
if (pos<=0) {
pos =0;
lbutton.addClass('notinuse');
}
rbutton.removeClass('notinuse');
item.data('pos',pos);
ul.stop();
ul.cssAnimate({'left':(0-(pos*step))+"px"},{duration:300,queue:false});
} else {
var ull = ul.position().left;
var lil = ul.find('li.selected').position().left;
searchPrevTeaser(ul.find('li.selected'));
if (ull+lil<0) {
var pos = item.data('pos');
var maxentry = item.data('maxentry');
var step = item.data('step');
pos = pos - 1;
if (pos<0) {
pos = maxentry-amount_per_page;
}
item.data('pos',pos);
ul.stop();
ul.cssAnimate({'left':(0-(pos*step))+"px"},{duration:300,queue:false});
}
if (ull+lil>960) {
var pos = item.data('pos');
var maxentry = item.data('maxentry');
var step = item.data('step');
pos = maxentry-amount_per_page;
item.data('pos',pos);
ul.stop();
ul.cssAnimate({'left':(0-(pos*step))+"px"},{duration:300,queue:false});
}
}
});
rbutton.click(function() {
if (pd.css('display') != 'block') {
var pos = item.data('pos');
var maxentry = item.data('maxentry');
var step = item.data('step');
pos = pos + 1;
var napp = amount_per_page;
if (jQuery(window).width()<462) napp = 1;
if (pos>=maxentry-napp) {
pos=maxentry-napp;
rbutton.addClass('notinuse');
}
lbutton.removeClass('notinuse');
item.data('pos',pos);
ul.stop();
ul.cssAnimate({'left':(0-(pos*step))+"px"},{duration:300,queue:false});
} else {
searchNextTeaser(ul.find('li.selected'));
var ull = ul.position().left;
var lil = ul.find('li.selected').position().left;
if (lil>730) {
var pos = item.data('pos');
var maxentry = item.data('maxentry');
var step = item.data('step');
pos=pos+1;
if (pos > maxentry-amount_per_page) pos=0;
item.data('pos',pos);
ul.stop();
ul.cssAnimate({'left':(0-(pos*step))+"px"},{duration:300,queue:false});
}
}
});
cbutton.click(function() {
cbutton.removeClass('showen');
pd.fadeOut(300);
ul.find('li').each(function() {
var li=jQuery(this);
li.animate({'opacity':1},{duration:200,queue:false});
li.removeClass('notclickable');
li.removeClass('selected');
pd.find('.portfolio_detail_mediaholder').html('');
});
item.addClass("hoverable");
});
jQuery('#portfolio_details_mask').each(function() {
var mask=jQuery(this);
setInterval(function() {
mask.stop();
var newh = pd.height() + 50;
if (pd.css('display') == "none") newh =0;
mask.animate({'height':(newh)+"px"},{duration:200,queue:false});
},100);
});
// - CLICKIN ON THE MORE BUTTON WILL OPEN SOME EXTRA DETAIL VEIW - //
item.find('.tp_teaser_rotator ul >li').each(function() {
var li=jQuery(this);
var button=li.find('.viewproject');
button.click(function() {
if (jQuery(this).find('a').data('href') !=true) {
item.removeClass('hoverable');
rbutton.removeClass('notinuse');
lbutton.removeClass('notinuse');
cbutton.addClass('showen');
var button=jQuery(this);
var li=button.closest('li');
// UNCLICKABLE LI SIBLINGS
li.closest('ul').find('li').each(function() {
var mli = jQuery(this);
mli.removeClass('selected');
mli.animate({'opacity':0.3},{duration:200,queue:false});
mli.addClass('notclickable');
});
li.animate({'opacity':1},{duration:200,queue:false});
li.removeClass('notclickable');
li.addClass('selected');
// ADD THE DETAIL INFORMATIONS TO THE DETAIL WINDOW
setTimeout(function() {
pd.find('.portfolio_detail_mediaholder').html(li.data('media'));
jQuery('.portfolio_detail_mediaholder audio,.portfolio_detail_mediaholder video').mediaelementplayer({
pluginPath: 'http://www.kdjinternational.com/wp-content/themes/alterego/js/',
flashName: 'flashmediaelement.swf',
silverlightName: 'silverlightmediaelement.xap',
success: function(player, node) {
jQuery('#' + node.id + '-mode').html('mode: ' + player.pluginType);
}
});
if (pd.find('.portfolio_detail_mediaholder').find('audio').length>0) {
pd.find('.portfolio_detail_mediaholder').addClass('audiopreview');
pd.find('.portfolio_detail_info_holder').addClass('audiopreview');
} else {
pd.find('.portfolio_detail_mediaholder').removeClass('audiopreview');
pd.find('.portfolio_detail_info_holder').removeClass('audiopreview');
}
},200);
pd.find('.topline').html(li.data('title'));
pd.find('.subline').html(li.data('subline'));
pd.find('#detail_innerhtml').html(li.data('innerhtml'));
// WAIT FOR THE LOADING OF THE BIG IMAGE
pd.waitForImages(
function() {
setTimeout(function() {pd.fadeIn(300);},50);
jQuery('body,html').animate({ scrollTop: (jQuery('#portfolio_details_mask').offset().top - 50)+"px" }, { duration: 500});
});
return false;
}
});
});
});
}
////////////////////////////////
// INITIALISATION OF LIGHTBOX //
///////////////////////////////
function initLightboxPlugin() {
jQuery("a[rel^='prettyPhoto']").prettyPhoto({overlay_gallery: false,social_tools:false});
jQuery("body").find('.tp_teaser_imgholder').each(function() {
var thi=jQuery(this);
var ht= thi.find('p').html();
thi.find('p').remove();
thi.append(ht);
thi.waitForImages(function() {
thi.height(thi.find('img:first').height());
});
});
}
///////////////////////
// INIT SEARCH FIELD //
//////////////////////
function initSearchField() {
// Check the Search value on Standard
jQuery(".reply-form .inputbox,.contactform .inputbox, .contactform .textbox, #Form_Search, #commentfields .inputbox, #commentfields .InputBox, #commentfields .TextBox").each(function() {
var field=jQuery(this);
field.data('standard',field.val());
});
jQuery(".reply-form .inputbox, .contactform .inputbox, .contactform .textbox, #Form_Search, #commentfields .inputbox,#commentfields .InputBox, #commentfields .TextBox").focus(function(){
var $this = jQuery(this);
$this.val($this.val()== $this.data('standard') ? "" : $this.val());
});
jQuery(".reply-form .inputbox, .contactform .inputbox, .contactform .textbox, #Form_Search, #commentfields .inputbox,#commentfields .InputBox, #commentfields .TextBox").blur(function(){
var $this = jQuery(this);
$this.val($this.val()== "" ? $this.data('standard') : $this.val());
});
}
//////////////////////////////
// NAVIGATION INITALISATION //
//////////////////////////////
function initNav() {
var nav = jQuery('#nav');
nav.find('ul li ul').each(function() {
var li=jQuery(this).find('>li').last();
});
nav.find('ul li ul').each(function(i) {
var ul =jQuery(this);
ul.parent().addClass('withchilds');
ul.data('height',ul.height());
ul.animate({'height':'0px'},{duration:230,queue:false});
//ul.slideUp(0);
});
/* NAVIGATION */
nav.find(' li').each(function() {
jQuery(this).hover(
function() {
var ul=jQuery(this).find('ul:first');
ul.stop();
clearTimeout(ul.data('timeout'));
clearTimeout(ul.data('timeout2'));
ul.css({'display':'block'});
setTimeout(function() {
var newh=0;
ul.find('>li').each(function() {
newh=newh+jQuery(this).outerHeight();
});
ul.data('height',newh);
ul.stop();
ul.animate({'height':ul.data('height')+"px",'opacity':1.0},{duration:180,queue:false});
},50);
ul.animate({'height':ul.data('height')+"px",'opacity':1.0},{duration:230,queue:false});
},
function() {
var ul=jQuery(this).find('ul:first');
ul.stop();
//li.delay(100).slideUp(230);
//clearTimeout(li.data('timeout'));
ul.data('timeout',setTimeout(function() {
ul.animate({'height':"0px",'opacity':0},{duration:230,queue:false});
ul.data('timeout2',setTimeout(function() {ul.css({'display':'none'})},230));
},100));
});
});
}
/*********************/
/* Footer Handler */
/********************/
function footerHandler() {
jQuery('#content_container #content').append('
');
jQuery(window).resize(function() {
organiseBgs();
});
setInterval(function() {
organiseBgs();
},100);
}
/**************************
- List Fade -
***************************/
function listfades() {
jQuery('.listfade').find('>li').each(function() {
var li=jQuery(this);
li.hover(function() {
var li=jQuery(this);
li.addClass('listover');
li.find('img:first').addClass('listovereffect');
li.closest('ul').find('>li').each(function(i) {
var lis = jQuery(this);
lis.stop();
if (!lis.hasClass('listover'))
lis.animate({opacity:0.3},{duration:300,queue:false});
else
lis.animate({opacity:1},{duration:300,queue:false});
});
},
function() {
var li=jQuery(this);
li.removeClass('listover');
li.find('img:first').removeClass('listovereffect');
li.siblings().each(function() {
var lis = jQuery(this);
lis.stop();
lis.animate({opacity:1},{duration:300,queue:false});
});
li.stop();
li.animate({opacity:1},{duration:300,queue:false});
});
});
jQuery('.listfade-img').find('>li').each(function() {
var li=jQuery(this);
li.hover(function() {
var li=jQuery(this);
li.addClass('listover');
li.find('img:first').addClass('listovereffect');
li.closest('ul').find('>li').each(function(i) {
var lis = jQuery(this);
lis.stop();
if (!lis.hasClass('listover'))
lis.find('img:first').animate({opacity:0.3},{duration:300,queue:false});
else
lis.find('img:first').animate({opacity:1},{duration:300,queue:false});
});
},
function() {
var li=jQuery(this);
li.removeClass('listover');
li.find('img:first').removeClass('listovereffect');
li.siblings().each(function() {
var lis = jQuery(this);
lis.stop();
lis.find('img:first').animate({opacity:1},{duration:300,queue:false});
});
li.stop();
li.find('img:first').animate({opacity:1},{duration:300,queue:false});
});
});
}
//////////////////////////////////////////////////////////
// PUT THE FOOTER,CONTAINER ETC. IN THE RIGHT POSITION //
/////////////////////////////////////////////////////////
function organiseBgs() {
var mainh = jQuery('#content_container').outerHeight();
var footer = jQuery('#footer');
var footerh = footer.outerHeight();
var subfooterh = jQuery('#sub_footer').outerHeight();
var windowh = jQuery(window).height();
var fj = jQuery('#footerjustify');
var fjh = fj.height();
var dif = windowh - (footerh + 100 + subfooterh + mainh);
if (jQuery('body').data('fjanimateon') != 1) {
if (dif>0 && (dif-fjh)>1) {
jQuery('body').data('fjanimateon',1);
fj.animate({'height':dif+"px"},{duration:600,queue:false,complete:function() {jQuery('body').data('fjanimateon',0);}});
}
if (dif<0) {
fj.stop();
jQuery('body').data('fjanimateon',1);
fj.animate({'height':"0px"},{duration:600,queue:false,complete:function() {jQuery('body').data('fjanimateon',0);}});
}
}
}
//////////////////
// INITSOCIAL //
/////////////////
function initSocial() {
var socwidth=0;
var amount = jQuery('body').find('.socials li').length;
jQuery('body').find('.socials li').each(function(i) {
socwidth = socwidth + jQuery(this).width();
});
//socwidth = socwidth + ((amount)*10)
jQuery('body').find('.soc').each(function() {
var tt=jQuery(this).find(' .tooltip');
tt.css({'left':(-7-(tt.width()/2))+"px"});
setTimeout(function() {
tt.css({'left':(-7-(tt.width()/2))+"px"});
},500);
var tt = jQuery(this);
tt.hover(function() {
var tt=jQuery(this).find(' .tooltip');
tt.css({'left':(-7-(tt.width()/2))+"px"});
},function() {});
})
var socials= jQuery('body').find('.socials');
//socials.width(socwidth);
}
//////////////////////////
// MENU HANDLER //
//////////////////////////
function menuHandler() {
var defpar = jQuery('#nav').parents().length;
/*jQuery('#nav ul >li >a').each(function() {
jQuery(this).text(jQuery(this).text().toUpperCase());
});*/
jQuery('#nav li >a').each(function() {
var a=jQuery(this);
var par= a.parents().length-defpar -3;
if (par==0)
var newtxt=jQuery(""+a.text()+"
").text();
else
if (par==2)
var newtxt=jQuery(" "+a.text()+"
").text();
else
if (par==4)
var newtxt=jQuery(" "+a.text()+"
").text();
jQuery('#responsive-menu select').append(new Option(newtxt,a.attr('href')) );
});
var aktmenu=jQuery('.current_page_item a:first').text();
jQuery('#responsive-menu-button').html(aktmenu);
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {
jQuery('#responsive-menu select').addClass('apple');
}
}
//////////////////////////
// INIT THE SITEMAPS //
//////////////////////////
function initSiteMaps() {
var defpar = jQuery('#nav').parents().length;
jQuery('#nav ul:first>li >a').each(function() {
var a=jQuery(this);
var child = a.parent().find('ul').length;
var newtxt=a.text().toLowerCase();
newtxt = newtxt.charAt(0).toUpperCase() + newtxt.slice(1);
jQuery('.footersitemap').each(function(i) {
var ul=jQuery(this);
if (child>0) {
ul.append(''+newtxt+'
');
var latest=ul.find('.latestmapli');
latest.removeClass('latestmapli');
latest = latest.find('.submenus');
a.parent().find('ul:first>li >a').each(function() {
var a2=jQuery(this);
var child = a2.parent().find('ul').length;
var newtxt=a2.text();
latest.append(''+newtxt+' ');
});
} else {
ul.append(''+newtxt+' ');
}
});
});
jQuery('.footersitemap .submenus').each(function(i) {
var ul=jQuery(this);
var ulh = ul.find('li').length * 28;
ul.css({'top':(-50-ulh)+"px"});
});
}
//////////////////////////////
// INIT THE TESTIMONIALS //
/////////////////////////////
function initTestimonials() {
jQuery('.tp_testimonials').each(function() {
var test=jQuery(this);
var ul=test.find('ul:first');
var lbutton = test.find('.tp_testimonials_left');
var rbutton = test.find('.tp_testimonials_right');
pos=0;
var maxe = test.find('ul >li').length;
// IF WINDOW IS RESIZED, THEN SLIDES NEED TO BE MOVED INTO THE RIGHT POSITION
jQuery(window).resize(function() {
clearTimeout(test.data('resized'));
test.data('resized',setTimeout(function() {
test.find('ul >li').each(function(i) {
var li=jQuery(this);
if (i!=pos) {
li.animate({'opacity':0});
} else {
li.animate({'opacity':1});
ul.animate({'height':li.outerHeight()+"px"},{duration:300});
}
});
},200));
});
test.find('ul >li').each(function(i) {
var li=jQuery(this);
if (i!=0) {
li.animate({'opacity':0});
} else {
li.animate({'opacity':1});
ul.animate({'height':li.outerHeight()+"px"},{duration:300});
}
});
lbutton.click(function() {
pos=pos-1;
if (pos<0) pos=maxe-1;
test.find('ul >li').each(function(i) {
var li=jQuery(this);
li.stop();
if (i!=pos) {
li.animate({'left':'400px','opacity':0},{duration:300});
} else {
li.css({'left':'-400px','opacity':0});
li.animate({'left':'0px','opacity':1},{duration:300});
ul.animate({'height':li.outerHeight()+"px"},{duration:300});
}
});
});
rbutton.click(function() {
pos=pos+1;
if (pos==maxe) pos=0;
test.find('ul >li').each(function(i) {
var li=jQuery(this);
li.stop();
if (i!=pos) {
li.animate({'left':'-400px','opacity':0},{duration:300});
} else {
li.css({'left':'400px','opacity':0});
li.animate({'left':'0px','opacity':1},{duration:300});
ul.animate({'height':li.outerHeight()+"px"},{duration:300});
}
});
});
});
}
function initAudio(){
jQuery('audio,video').mediaelementplayer({
pluginPath: 'http://www.kdjinternational.com/wp-content/themes/alterego/js/',
// name of flash file
flashName: 'flashmediaelement.swf',
// name of silverlight file
silverlightName: 'silverlightmediaelement.xap',
success: function(player, node) {
jQuery('#' + node.id + '-mode').html('mode: ' + player.pluginType);
}
});
}
/*
* Skeleton V1.1
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 8/17/2011
*/
jQuery('body').on('click', 'ul.tabs > li > a', function(e) {
//Get Location of tab's content
var contentLocation = $(this).attr('href');
//Let go if not a hashed one
if(contentLocation.charAt(0)=="#") {
e.preventDefault();
//Make Tab Active
$(this).parent().siblings().children('a').removeClass('active');
$(this).addClass('active');
//Show Tab Content & add active class
$(contentLocation).show().addClass('active').siblings().hide().removeClass('active');
}
});
function tabsInit() {
/*
* Skeleton V1.1
* Copyright 2011, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 8/17/2011
*/
/* Tabs Activiation
================================================== */
var tabs = jQuery('ul.tabs');
tabs.each(function(i) {
//Get all tabs
var tab = jQuery(this).find('> li > a');
tab.click(function(e) {
//Get Location of tab's content
var contentLocation = jQuery(this).attr('href');
//Let go if not a hashed one
if(contentLocation.charAt(0)=="#") {
e.preventDefault();
//Make Tab Active
tab.removeClass('active');
jQuery(this).addClass('active');
//Show Tab Content & add active class
jQuery(contentLocation).show().addClass('active').siblings().hide().removeClass('active');
}
});
});
}
jQuery(window).load(function(){
(function(d, s, id) {
if(jQuery(".fb-like").length) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=162252937201892";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'facebook-jssdk'));
});