Fader for elements

//Fader
function ezbFade(eid,time){
if(time) fadeTime = time
else fadeTime = 1000.0;
var element = document.getElementById(eid);
if(element == null) return;
if(element.FadeState == null){
if(element.style.opacity == null || element.style.opacity == '' || element.style.opacity == '1') element.FadeState = 2;
else element.FadeState = -2;
}
if(element.FadeState == 1 || element.FadeState == -1){
element.FadeState = element.FadeState == 1 ? -1 : 1;
element.FadeTimeLeft = fadeTime - element.FadeTimeLeft;
}
else{
element.FadeState = element.FadeState == 2 ? -1 : 1;
element.FadeTimeLeft = fadeTime;
setTimeout("ezbAnimateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
}
}

function ezbAnimateFade(lastTick,eid){
var curTick = new Date().getTime();
var elapsedTicks = curTick - lastTick;
var element = document.getElementById(eid);
if(element.FadeTimeLeft <= elapsedTicks){
element.style.opacity = element.FadeState == 1 ? '1' : '0';
element.style.filter = 'alpha(opacity = ' + (element.FadeState == 1 ? '100' : '0') + ')';
element.FadeState = element.FadeState == 1 ? 2 : -2;
return;
}
element.FadeTimeLeft -= elapsedTicks;
var newOpVal = element.FadeTimeLeft/fadeTime;
if(element.FadeState == 1) newOpVal = 1 - newOpVal;
element.style.opacity = newOpVal;
element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
setTimeout("ezbAnimateFade(" + curTick + ",'" + eid + "')", 33);
}

Box Shadow

.shadow{
-moz-box-shadow: 1px 1px 3px #4D4C5A;
-webkit-box-shadow: 1px 1px 3px #4D4C5A;
box-shadow: 1px 1px 3px #4D4C5A;
filter: progid:DXImageTransform.Microsoft.Shadow(color=#4D4C5A,direction=135,strength=2);
}

Detect mouse out of browser

function ezbAddEvent(object,oEvent,fnctn){
if(object.addEventListener) object.addEventListener(oEvent,fnctn,false);
else if(object.attachEvent) object.attachEvent("on" + oEvent, fnctn);
}
ezbAddEvent(window,"load",function(e){
ezbAddEvent(document,"mouseout",function(e){
e = e ? e : window.event;
var from = e.relatedTarget || e.toElement;
if(!from || from.nodeName == "HTML") alert('Mouse Left Browser');
});
});

If class exists styling

<script type="text/javascript">

if(getElementsByClass("Breadcrumb", null, "div") == ''){
var contentDiv = document.getElementById('LayoutColumn2');
if(contentDiv){
contentDiv.style.backgroundPosition='top';
contentDiv.style.marginTop='10px';
}
}

function getElementsByClass(searchClass, domNode, tagName) {
if (domNode == null) domNode = document;
if (tagName == null) tagName = '*';
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = " "+searchClass+" ";
for(i=0,j=0; i<tags.length; i++) {
var test = " " + tags[i].className + " ";
if (test.indexOf(tcl) != -1)
el[j++] = tags[i];
}
return el;
}

</script>

Getting Relative Dates

// "Last Sunday" gets the sunday of the current week
// "This Sunday" gets the sunday of the current week until the actual date is a wednesday
// "Next Sunday" gets the next sunday no matter what day you are on

//last sunday
echo date("Y-m-d", strtotime("last Sunday"));

//two weeks ago sunday
echo date("Y-m-d", strtotime("last Sunday -1 weeks"));

// two weeks ago sunday plus a day. the second example is just to show that you can stack up the added or subtracted dates in case you need to do so
echo date("Y-m-d", strtotime("last Monday -1 weeks"));
echo date("Y-m-d", strtotime("last Sunday -1 weeks +1 days"));

Apply template to all child pages

<?php
$page_children = get_pages('child_of=6215');
foreach($page_children as $child){
$current_page_template = get_post_meta($child->ID,'_wp_page_template',true);
if($current_page_template != 'page-kyle.php') update_post_meta($child->ID,'_wp_page_template','page-kyle.php');
}
?>

Custom post icon

$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'menu_icon' => SHIBA_PLUGIN_URL .'/images/shiba-icon1b.jpg', // 16px16
'supports' => array('title','thumbnail','excerpt')
);
register_post_type('gallery',$args);

Replace BC Globals

<script type="text/javascript">
function cleanOutParens(string){
var items = string;
var cleanItems = items.replace('(','');
cleanItems = cleanItems.replace(')','');
document.write(cleanItems);
}
</script>

<span id="cart-items"><script type="text/javascript">cleanOutParens('%%GLOBAL_CartItems%%');</script>