function writeFlash(p) {
    p.wmode = 'transparent';
    writeEmbed(
		'D27CDB6E-AE6D-11cf-96B8-444553540000',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'application/x-shockwave-flash',
		p
	);
}

function writeShockWave(p) {
    writeEmbed(
	'166B1BCA-3F9C-11CF-8075-444553540000',
	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
	'application/x-director',
		p
	);
}

function writeQuickTime(p) {
    writeEmbed(
		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
		'video/quicktime',
		p
	);
}

function writeRealMedia(p) {
    writeEmbed(
		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'audio/x-pn-realaudio-plugin',
		p
	);
}

function writeWindowsMedia(p) {
    p.url = p.src;
    writeEmbed(
		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
		'application/x-mplayer2',
		p
	);
}

function writeEmbed(cls, cb, mt, p) {
    var h = '', n;

    h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
    h += typeof (p.id) != "undefined" ? 'id="' + p.id + '"' : '';
    h += typeof (p.name) != "undefined" ? 'name="' + p.name + '"' : '';
    h += typeof (p.width) != "undefined" ? 'width="' + p.width + '"' : '';
    h += typeof (p.height) != "undefined" ? 'height="' + p.height + '"' : '';
    h += typeof (p.align) != "undefined" ? 'align="' + p.align + '"' : '';
    h += typeof (p.wmode) != "undefined" ? 'wmode="' + p.wmode + '"' : '';
    h += '>';

    for (n in p)
        h += '<param name="' + n + '" value="' + p[n] + '">';

    h += '<embed type="' + mt + '"';

    for (n in p)
        h += n + '="' + p[n] + '" ';

    h += '></embed></object>';

    document.write(h);
}

// jquery.elastic-1.6.3 - http://www.unwrongest.com/projects/elastic/
jQuery.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false}var $textarea=jQuery(this),$twin=jQuery('<div />').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight<0){maxheight=Number.MAX_VALUE}$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()))}function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow})}}function update(){var textareaContent=$textarea.val().replace(/&/g,'&amp;').replace(/  /g,'&nbsp;').replace(/<|>/g,'&gt;').replace(/\n/g,'<br />');var twinContent=$twin.html();if(textareaContent+'&nbsp;'!=twinContent){$twin.html(textareaContent+'&nbsp;');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto')}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden')}else{setHeightAndOverflow(goalheight,'hidden')}}}}$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update()});$textarea.live('input paste',function(e){setTimeout(update,250)});update()})}});

$(function(){
	
	//'' Rounded Corners
	DD_roundies.addRule("#navMain, #navCategory, #navRecent, #categoryList, #moreForming", 8);
	DD_roundies.addRule("#navMain .vertical, #navCategory .vertical, #navRecent .vertical, #categoryList .vertical", "0 0 8px 8px");
	DD_roundies.addRule("#navMain .vertical li a, #navCategory .vertical li a, #navRecent .vertical li a, #categoryList .vertical li a", 5);
	DD_roundies.addRule("#content div.commentAdd", 8);
	DD_roundies.addRule("#footerCarousel", 18);
	//''
	
	//'' Add New Contact Form Features
	var cnt = $("#content");
	cnt.mjLbl = cnt.find(".commentAdd span.commentName");
	cnt.mjTxt = cnt.find(".commentAdd input.commentNewName");
	
	cnt.mjTxt.bind("keyup blur", function(e){
		cnt.mjTxt.val()!="" ?
			cnt.mjLbl.text( cnt.mjTxt.val() ) :
			cnt.mjLbl.text( "Name" );
	});
	cnt.mjTxt.val()!="" && cnt.mjLbl.text( cnt.mjTxt.val() );
	
	cnt.find(".commentAdd span.commentText").click(function(){
			$(this).find("textarea").focus();
		})
		.find("textarea").elastic();
	//''
	
});
