Darkstrand « visit
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Darkstrand - http://darkstrand.com
// .select needs to be onclick
function highlight(target_nod) {
if(target_nod.value == target_nod.getAttribute("value")) {
target_nod.select();
}
}
function clearValue(target_nod) {
if(target_nod.value == target_nod.getAttribute("value")) {
target_nod.defaultVal=target_nod.value;
target_nod.value="";
}
}
function rePop(target_nod) {
if (target_nod.value=="" && target_nod.defaultVal) {
target_nod.value = target_nod.defaultVal;
}
}
function checkEmail(val_str) {
email_exp = /^[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
if(email_exp.test(val_str)==true) {
return true;
} else {
return false;
}
}
function validForm() {
// Set flag
var flag_bln = false;
// Clear Errors (done here because Email can error two ways
$("label").removeClass("error");
// Check all .req fields
$(".req").each(function() {
if( ($("input",this).length>0 && $("input",this).attr("value") == $("input",this).attr("defaultValue")) || ( $("select",this).length>0 && $("select",this).attr("value") == "" ) || ( $("textarea",this).length>0 && $("textarea",this).attr("value") == "") ) {
$(this).children("label").addClass("error");
if(flag_bln==false) {
alert_str = "Please complete all required fields."
};
flag_bln = true;
}
});
// Check Email field
if(!checkEmail($("#email").attr("value"))) {
$("#email-grp label").addClass("error");
if(flag_bln==false) {
alert_str = "Please enter a valid Email address."
};
flag_bln = true;
}
if(flag_bln) {
// NOOoo..
return alert_str;
} else {
return true;
}
}
// Modal show/hide functions:
function modalOpen(dialog) {
dialog.overlay.fadeIn('slow', function () {
dialog.container.fadeIn('slow');
dialog.data.hide().fadeIn('slow');
});
}
function modalClose(dialog) {
dialog.overlay.fadeOut('slow');
dialog.container.fadeOut('slow');
dialog.data.fadeOut('slow', function () {
$.modal.close();
});
}
/*
Text to be replaced with an image is wrapped in a span with an empty span
prepended, as some are block level and cannot be restyled due to positioning:
Example: <h3>Text</h3> => <h3><span><span></span>Text</span></h3>
*/
function imgReplace(target_nod) {
target_nod.prepend("<span></span>").wrapInner("<span></span>")
}
function contactLoaded() {
// Give the loaded content new id's to avoid conflicts:
$("#contact-form #primary-content").attr("id","c-primary-content");
$("#contact-form #secondary-content").attr("id","c-secondary-content");
$("#c-primary-content").appendTo("body");
$("#c-secondary-content").appendTo("body");
$("#contact-form").contents().remove();
$("#c-primary-content").appendTo("#contact-form");
$("#c-secondary-content").appendTo("#contact-form");
// Prevent from firing again when form data is returned:
$("#contact-form").unbind("ajaxComplete");
$("#contact-form").prepend("<h2></h2>");
$("#contact-form h2").text($("#contact-form h1").text());
$("#contact-form h1").remove();
imgReplace($("#contact-form h2"));
$("#contact-form #c-secondary-content > address, #contact-form #c-secondary-content > p").wrapAll("<div id='instructions'></div>");
$("#contact-form").prepend("<a id='close-btn'><img src='"+siteRoot_str+"images/close_btn.png' alt='Close' /></a>");
$("#close-btn").click(function() {
// Hide the form
$("#snav-contact a").removeClass("current");
$("#contact-container").slideUp(650);
return false;
});
$("#contact-form #submit").click(function() {
var alert = validForm()
// Validate that thing:
if(alert===true) {
// Add container element for returned data:
jQuery("<div id='returned' style='margin:0;padding:0;'></div>").appendTo("body").hide();
$("#returned").css("height",$('#contact-form form').innerHeight());
// Serialze form data to pass to .post():
data_str=$("#contact-form form").serialize();
$.post(
// Post to:
siteRoot_str+"contact/ajax_send.php"
// Data:
,data_str
// Callback:
,function(data) {
// alert(data);
if(data=="SUCCESS") {
//$('#contact-form').html("<div id='message'></div>");
$('#contact-form form').replaceWith($("#returned"));
$('#returned').html("<h3>Thank you for contacting Darkstrand.</h3>")
.append("<p>We have received your inquiry and will respond to your request in 1-2 business days.</p>")
.hide()
.fadeIn(1500);
} else {
$('#contact-form').html("<div id='message'></div>");
$('#message').html("<h2>FAIL!</h2>")
.append("<p>We will be in touch soon.</p>")
.hide()
.fadeIn(1500);
}
}
)
} else {
if ($('#contact-form form p.alert').length>0) {
$('#contact-form form p.alert').fadeOut(500, function() {
$('#contact-form form p.alert').remove();
jQuery("<p class='alert'>"+alert+"</p>").prependTo($('#contact-form form')).hide().fadeIn(500);
});
} else {
jQuery("<p class='alert'>"+alert+"</p>").prependTo($('#contact-form form')).hide().slideDown(500);
}
}
return false;
});
}
// Function used for pages with left hand tertiary nav:
function innerPageNav(triggersSel_str) {
// This method allows "show/hide" - but animation+sIFR still choppy in FF:
// Innitial hide, is not really a hide, to allow sIFR-ization:
$(triggersSel_str).not($(triggersSel_str)+":first").each(function() {
// Hide each triggers target way off the viewable area:
$($(this).attr("href")).css({
"position":"absolute",
"left":"-300em",
"width" : "415px",
"top":"-500em",
"z-index" : 1
});
});
$(triggersSel_str+":first").css({
"color":"#333"
});
$(triggersSel_str).click(function() {
$(triggersSel_str).each(function() {
// Hide each triggers target:
$($(this).attr("href")).hide();
// Remove .current from all
$(triggersSel_str).removeClass("current").stop().animate({
"color":"#eaa61d"
});
});
// Set as current
$(this).addClass("current").stop().animate({
"color":"#333"
},500);
// Position the clicked trigger's target somewhere reasonable & show:
$($(this).attr("href")).css({
"position" : "relative",
"top" : 0,
"left": 0,
"width" : "415px",
"z-index" : 0
}).stop().show();
// "return false" used now, will most likely change with History plugin:
return false;
});
/*
// Old 2:
$(triggersSel_str).click(function() {
$(triggersSel_str).each(function() {
// Hide each triggers target way off the viewable area:
$($(this).attr("href")).css({
"position":"absolute",
"left":"-300em",
"width" : "415px",
"top":"-500em",
"z-index" : 1
});
// Remove .current from all
$(triggersSel_str).removeClass("current").stop().animate({
"color":"#eaa61d"
});
});
// Set as current
$(this).addClass("current").stop().animate({
"color":"#333"
},500);
// Position the clicked trigger's target somewhere reasonable:
$($(this).attr("href")).css({
"position" : "relative",
"top" : 0,
"left": 0,
"width" : "415px",
"z-index" : 0
});
// "return false" used now, will most likely change with History plugin:
return false;
});
// Should check for hash in url and display based on that else:
$(triggersSel_str + ":first").click();
*/
}
// Calls to page specific js and js includes:
$(function() {
// Body id will override class when identifying a page
pageID_str = $('body').attr('id');
if(!pageID_str) {
pageID_str = $('body').attr('class');
};
// Wrap #container div in .jsEnabled div
$("body").wrapInner("<div class='jsEnabled'></div>");
// Move interior h1's outside of primary-content to clear primary-secondary:
$(".interior h1").insertBefore("#primary-content");
// title attribuTe interferes with dropdown in FF:
$("#primary-nav a").removeAttr("title");
// Wrap text of dropdowns with nested lists/nav in span:
$("#primary-nav > li > ul > li").each(function() {
if($("ul",this).length>0) {
tempSN_nod = $("ul",this);
$("ul",this).remove();
$(this).wrapInner("<span></span>");
$(this).append(tempSN_nod);
}
});
// Hide dd:
$("#primary-nav > li > ul").hide();
// Wrap whole nav for positioning (since actual ul defines page background image):
$("#primary-nav").wrap("<div id='pnav-wrap'></div>");
// Add rollover effect:
$("#primary-nav > li").hover(
function() {
$("#primary-nav > li").stop(false, false).animate({
paddingRight:"5px",
paddingBottom:"3px"
},200);
$("#primary-nav > li > ul").stop(false, true).slideUp(200)
$(this).stop(false, false).animate({
paddingRight:($(this).children("ul").innerWidth()+12)+"px",
paddingBottom:($(this).children("ul").innerHeight()+12)+"px"
}
,200
,'linear'
,function() {
$(this).children("ul").stop(false, false).slideDown({ duration:200 });
}
)
},
function() {
$("#primary-nav > li").stop(false, false).animate({
paddingRight:"5px",
paddingBottom:"3px"
},250);
$("#primary-nav > li > ul").stop(false, true).slideUp(250)
}
);
// Prepend the contact form:
jQuery("<div id='contact-container'></div>")
// Do it to it ... oh, but not the contact form
.prependTo($("body:not(#contact)"))
.hide()
.append(jQuery("<div id='contact-form'></div>")
.ajaxComplete(contactLoaded)
.load(siteRoot_str+"contact/ #container")
)
// $("#snav-contact a, #fnav-contact a").livequery('click',function() {
$("#snav-contact a").livequery('click',function() {
// Show the form
$("#snav-contact a").toggleClass("current");
$("#contact-container").slideToggle(650);
$.scrollTo("body",750);
return false;
});
imgReplace($("#supplementary-content h3"));
imgReplace($("#supplementary-content dt"));
$("#video").each(function() {
$(this).wrapInner("<div id='vid-container'></div>");
$(this).append("<div class='title'></div>");
});
// Setup media modals:
mediaCount_num = 0;
$(".media").each(function() {
mediaCount_num++;
$(this).attr("targ", "modal"+mediaCount_num);
jQuery("<div class='modal-pop' id="+$(this).attr("targ")+"><a class='simplemodal-close'><img src='"+siteRoot_str+"images/modal_close_btn.png' alt='Close' /></a><div class='modal-container'></div></div>").prependTo($("body")).hide();
});
$(".media").click(function() {
container_nod = $("#"+$(this).attr("targ")+" .modal-container")
target_nod = $("#"+$(this).attr("targ"));
/*container_nod.load($(this).attr("href")+" #primary-content", {}, function(){
$(".simplemodal-container #primary-content").attr("class","primary-content").removeAttr("id");
});*/
// Get last part of URL:
toTest_str = $(this).attr("href").substring($(this).attr("href").lastIndexOf("/")+1);
vars_obj = new Object();
if(toTest_str.indexOf("?")>=0) {
// Parse query string:
vars_arr = toTest_str.substring(toTest_str.indexOf("?")+1);
vars_arr = vars_arr.split("&");
for(l=0;l<vars_arr.length;l++) {
// Creat flashvars object:
vars_arr[l] = vars_arr[l].split("=");
vars_obj[vars_arr[l][0]] = vars_arr[l][1];
}
toTest_str = toTest_str.substring(0,toTest_str.indexOf("?"))
}
switch(toTest_str) {
case "network-map.php":
container_nod.attr("id","nm_swf");
var toLoad_str = siteRoot_str+"swf/network_map.swf";
var flashvars = vars_obj;
var params = {
menu: "false"
// ,wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(toLoad_str, "nm_swf", "811", "520", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
}
target_nod.modal({
onOpen: modalOpen
,onClose: modalClose
,close: false
});
return false;
});
// Page specific JS:
switch(pageID_str) {
case "home":
// Contact Info headings:
//imgReplace($("#secondary-content h3"));
imgReplace($("#tertiary-content h3"));
var flashvars = {
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
if($.cookies.get("darkstrand_visited")=="true") {
flashvars.targFrame="end";
} else {
$.cookies.set("darkstrand_visited", "true")
}
swfobject.embedSWF("swf/home_main.swf", "primary-content", "330", "960", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
break;
case "about":
// Call about page specific js here
break;
case "contact" :
$("#submit.btn").click(function(){
var alert = validForm();
if(alert !== true) {
// Append form alert here
return false;
}
});
break;
case "officers":
$("#primary-content").css({
"position" : "relative",
"z-index" : 1
});
innerPageNav("#tertiary-nav a");
break;
case "advisors":
$("#primary-content").css({
"position" : "relative",
"z-index" : 1
});
innerPageNav("#tertiary-nav a");
break;
case "products":
$(window).load(function () {
var flashvars = {
videoURL: siteRoot_str+"media/videos/Products_Overview_5-21-09.f4v"
,pauseTime: "6.23"
// ,buffer: "10"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(siteRoot_str+"swf/video_player.swf", "vid-container", "388", "218", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
});
break;
case "partnerships":
$(window).load(function () {
var flashvars = {
videoURL: siteRoot_str+"media/videos/Product_Solutions_Overview_5-21-09.f4v"
,pauseTime: "6.94"
// ,buffer: "10"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(siteRoot_str+"swf/video_player.swf", "vid-container", "388", "218", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
});
break;
case "pipe":
$(window).load(function () {
var flashvars = {
videoURL: siteRoot_str+"media/videos/Network_Pipe_5-21-09.f4v"
,pauseTime: "15.88"
,buffer: "17"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(siteRoot_str+"swf/video_player.swf", "vid-container", "388", "218", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
});
break;
case "product-manufacturing":
$(window).load(function () {
var flashvars = {
videoURL: siteRoot_str+"media/videos/Industries_Product_Manufacturing_5-21-09.f4v"
,pauseTime: "31.09"
,buffer: "32"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(siteRoot_str+"swf/video_player.swf", "vid-container", "388", "218", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
});
break;
case "industries":
$(window).load(function () {
var flashvars = {
videoURL: siteRoot_str+"media/videos/Industries_Overview_5-21-09.f4v"
,pauseTime: "8.5"
,buffer: "10"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(siteRoot_str+"swf/video_player.swf", "vid-container", "388", "218", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
});
break;
case "media":
$(window).load(function () {
var flashvars = {
videoURL: siteRoot_str+"media/videos/Industries_Media_5-21-09.f4v"
,pauseTime: "12"
,buffer: "13"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(siteRoot_str+"swf/video_player.swf", "vid-container", "388", "218", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
});
break;
case "biosciences":
$(window).load(function () {
var flashvars = {
videoURL: siteRoot_str+"media/videos/Industries_Bioscience_5-21-09.f4v"
,pauseTime: "19.5"
,buffer: "21"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(siteRoot_str+"swf/video_player.swf", "vid-container", "388", "218", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
});
break;
case "history":
$(window).load(function () {
var flashvars = {
videoURL: siteRoot_str+"media/videos/Company_History_5-21-09.f4v"
,pauseTime: "12.1"
,buffer: "13"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(siteRoot_str+"swf/video_player.swf", "vid-container", "388", "218", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
});
break;
case "faq":
$("#primary-content").css({
"position" : "relative",
"z-index" : 1
});
innerPageNav("#tertiary-nav a");
break;
case "pressindex" :
jQuery("<div id='val-modal'><img src='/images/ajax-loader.gif' /></div>").insertAfter($("#tertiary-nav"));
$("#val-modal").hide();
$("#pressnav a").click(function(){
// Reset pressnav items & hide all the tert nav
$("#pressnav > a").removeClass("active");
$("#tertiary-nav > *").hide();
$('div#press-content').hide();
$("#tertiary-nav tr").css({background:"none"});
$("#tertiary-nav a").removeClass("current").stop().animate({
"color":"#eaa61d"
});
// Show the ones associated with $(this)
$(this).addClass("active");
$($(this).attr("href")).show();
return false;
});
$("#pressnav a#link-pr").click(function(){
$('div#press-content').show();
});
$("#press-titles a").click(function(){
$("#val-modal").show();
var toLoad = $(this).attr('href');
// Reset all these lil' guys:
$("#tertiary-nav tr").css({background:"none"});
$("#tertiary-nav a").removeClass("current").stop().animate({
"color":"#eaa61d"
});
// Set $(this) as the current one:
$(this).addClass("current");
$(this).parent().parent().css({background:"#e7e6e2"});
$(this).stop().animate({
"color":"#333"
},500);
$('div#press-content').attr("id", "press-container").css("visibility","hidden");
$('div#press-container').load(toLoad+' #press-content', {}, function() {
$('div#press-container').css("visibility","visible");
$("#val-modal").hide();
});
return false;
});
break;
case "cities" :
$("#primary-content").wrap("<div id='pc-container'></div>");
var toLoad_str = siteRoot_str+"swf/network_map.swf";
var flashvars = {
init:"tentoforty"
};
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
};
swfobject.embedSWF(toLoad_str, "primary-content", "811", "520", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
break;
default :
}
// Wrap ".btn"'s in containing .btnw div and move the id to the added/parent div:
$('.btn').livequery(function() {
$(this).each(function() {
var tt = $(this).text() || $(this).val();
var b = $(this);
if ($(this).is("input")) {
$(this).wrap('<span class="'+this.className+'w" id="'+this.id+'w"></span>');
b = $(this).parent();
}
b.
prepend('<span class="left"></span>').
append('<span class="right"></span>');
});
})
// Site map slider
$("#footer-nav").hide();
//var tempSM_nod = $("#sitemap-f > div");
nameBack = $("#sitemap-f > div").attr("id")
$("#sitemap-f > div").clone(true).attr("id","fTemp").appendTo("body");
$("#sitemap-f > div").remove();
$("#sitemap-f").wrapInner("<a id='sitemap-link'></a>");
$("#fTemp").appendTo("#sitemap-f");
$("#fTemp").attr("id",nameBack)
$("<span id='sitemap-top'></span>").prependTo("#sitemap-f > ul");
$("<span id='sitemap-btm'></span>").insertAfter("#sitemap-f > ul");
var down = false;
$("#sitemap-link").click(function() {
$("#footer-nav").slideToggle(650);
$.scrollTo("#footer-nav",750);
});
// Add target='_blank' to all .external links
$("a.pdf, a.external").livequery(function(){
$(this).attr("target","_blank");
});
// $("a.watch");
var toLoad_str = siteRoot_str+"swf/ds_researchPartners.swf";
var flashvars = {
};
var params = {
menu: "false"
// ,wmode: "transparent"
};
var attributes = {
};
if($("#promo").length>0) {
swfobject.embedSWF(toLoad_str, "promo", "216", "131", "9.0.0","swf/expressInstall.swf", flashvars, params, attributes);
}
try {
var pageTracker = _gat._getTracker("UA-4589210-1");
pageTracker._trackPageview();
} catch(err) {}
});
// sIFR:
var dinEng_swf = {
src: siteRoot_str+"swf/din_eng.swf"
};
var tradeGothBld_swf = {
src: siteRoot_str+"swf/trade_gothic_bold.swf"
};
sIFR.activate(dinEng_swf, tradeGothBld_swf);
// sIFR called on window load to make sure everything else is done doin it's thang:
$(window).load(function () {
// Interior H1:
sIFR.replace(dinEng_swf, {
selector:'.interior h1'
,wmode: 'transparent'
,css: [
// '.sIFR-root { color:#f6bd1f; text-transform:uppercase }'
'.sIFR-root { color:#eaa61d; text-transform:uppercase }'
,'a { text-decoration: none; }'
,'a:link { color: #738cad; }'
,'a:hover { color: #43557e; }'
]
,ratios: [8, 1.3, 11, 1.21, 12, 1.2, 14, 1.19, 21, 1.16, 28, 1.13, 38, 1.12, 61, 1.11, 94, 1.1, 95, 1.09, 103, 1.1, 107, 1.09, 110, 1.1, 119, 1.09, 120, 1.1, 1.09]
});
if(!$("body#pressindex").length>0) {
// Interior H2:
sIFR.replace(dinEng_swf, {
selector:'.home #secondary-content h3, .interior .jsEnabled h2'
,wmode: 'transparent'
,css: [
'.sIFR-root { color:#887f6f; text-transform:uppercase }'
,'a { text-decoration: none; }'
,'a:link { color: #738cad; }'
,'a:hover { color: #43557e; }'
]
,ratios: [8, 1.3, 11, 1.21, 12, 1.2, 14, 1.19, 21, 1.16, 28, 1.13, 38, 1.12, 61, 1.11, 94, 1.1, 95, 1.09, 103, 1.1, 107, 1.09, 110, 1.1, 119, 1.09, 120, 1.1, 1.09]
});
/*
// H3:
sIFR.replace(tradeGothBld_swf, {
selector:'.interior #primary-content h3'
,wmode: 'transparent'
,css: [
'.sIFR-root { color:#333333; }'
,'a { text-decoration: none; }'
,'a:link { color: #738cad; }'
,'a:hover { color: #43557e; }'
]
,ratios: [8, 1.3, 11, 1.21, 12, 1.2, 14, 1.19, 21, 1.16, 28, 1.13, 38, 1.12, 61, 1.11, 94, 1.1, 95, 1.09, 103, 1.1, 107, 1.09, 110, 1.1, 119, 1.09, 120, 1.1, 1.09]
});
// Latest News DT:
sIFR.replace(tradeGothBld_swf, {
selector:'#latest-news dt'
,wmode: 'transparent'
,css: [
'.sIFR-root { color:#333333; text-transform:uppercase }'
,'a { text-decoration: none; }'
,'a:link { color: #738cad; }'
,'a:hover { color: #43557e; }'
]
,ratios: [8, 1.3, 11, 1.21, 12, 1.2, 14, 1.19, 21, 1.16, 28, 1.13, 38, 1.12, 61, 1.11, 94, 1.1, 95, 1.09, 103, 1.1, 107, 1.09, 110, 1.1, 119, 1.09, 120, 1.1, 1.09]
});*/
}
// IE png fixes:
if($.browser.version<"7" && $.browser.msie) {
$(".homelink, #supplementary-content, .btnw").supersleight();
}
});
// Other fun stuff:
// Clear and Repopulate text fields
$("input[@type=text]").focus(function(){
clearValue(this);
});
$("input[@type=text]").blur(function(){
rePop(this);
})
Syndicate
Categories
Statistics
There are 330 Sites with 745 Links of Interest in 18 Categories. The latest Site was added 4 months ago.
About
This is a project by Sebastian Senf, for his part jQuery user and lover too. Follow me.