/**
 * jCorners - Cross-Browser Corners with JQuery
 *   http://jcorners.culturezoo.com/
 *
 * Copyright (c) 2008 Levi Nunnink, Culturezoo, LLC (http://culturezoo.com)
 * Licensed under the GPL
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Corners Experiment" by Jonathan Snook
 *   http://snook.ca/archives/html_and_css/rounded_corners_experiment_ie/
 */

var defaults = {
	radius: 10
};
jQuery.fn.jcorners = function(o) {
	return this.each(function() {
		new jQuery.jcorners(this, o);
	});
};
jQuery.jcorners = function(e, o) {
	//this.options = $.extend({}, defaults, o || {});
	if(jQuery.browser.msie){
		//jQuery("body").prepend("<xml:namespace ns='urn:schemas-microsoft-com:vml' prefix='v' />");
		/*
		if(jQuery(e).css("background-color") != undefined){
			var bg = jQuery(e).css("background-color");
		}else{
			var bg = "white";
		}
		var guid = e.uniqueID;
		var padding = jQuery.intval(jQuery(e).css("padding"));
		var arc = (o.radius / (jQuery(e).height()));
		jQuery(e).wrap("<v:roundrect hasLayout='true' arcsize='"+arc+"' class='corner-wrapper' id='wrapper-"+guid+"' fillcolor='"+bg+"' strokecolor='"+bg+"'></v:roundrect>");
		jQuery("#wrapper-"+guid+"").css("behavior","url(#default#VML)");
		jQuery("#wrapper-"+guid+"").css("background-color","transparent");
		jQuery("#wrapper-"+guid+"").css("padding",o.radius*2+"px");
		jQuery("#wrapper-"+guid+"").css("height","100%");
		jQuery("#wrapper-"+guid+"").css("width",jQuery(e).width()+o.radius*2+"px");
		jQuery("#wrapper-"+guid+"").css("border-color:",bg);
		jQuery("#wrapper-"+guid+"").css("display","inline-block");
		*/
		//if (!jQuery(document).namespaces.v) {
		//  jQuery(document).namespaces.add("v", "urn:schemas-microsoft-com:vml");
		//}
		/*
		var arcSize = Math.min(parseInt(jQuery(e).css('-moz-border-radius') ||
										jQuery(e).css('moz-border-radius') ||
										jQuery(e).css('border-radius')) /
							   Math.min(jQuery(e).offsetWidth, jQuery(e).offsetHeight), 1);
		var strokeColor = jQuery(e).css('border-color'); var strokeWeight = jQuery(e).css('border-width'); jQuery(e).css('border', 'none');
		var fillColor = jQuery(e).css('background-color'); var fillSrc = jQuery(e).css('background-image').replace(/^url\("(.+)"\)$/, '$1'); jQuery(e).css('background','transparent');
		var margin = jQuery(e).css('margin'); jQuery(e).css('margin','0');
		var styleFloat = jQuery(e).css('float'); jQuery(e).css('float', 'none');
		var clear = jQuery(e).css('clear'); jQuery(e).css('clear', 'none');
		var position = jQuery(e).css('position'); jQuery(e).css('position', 'static');
		var left = jQuery(e).css('left'); jQuery(e).css('left','0');
		var right = jQuery(e).css('right'); jQuery(e).css('right', '0');
		var top = jQuery(e).css('top'); jQuery(e).css('top', '0');
		var bottom = jQuery(e).css('bottom'); jQuery(e).css('bottom', '0');
		var width = jQuery(e).css('width'); jQuery(e).css('width', '100%');
		var height = jQuery(e).css('height'); jQuery(e).css('height', '100%');
		jQuery(e).wrap = '<v:roundrect arcsize="' + arcSize + '" stroked="false" style="behavior: url(#default#VML); display: inline-block; width: '+width+'; height: '+height+'; antialias: true; padding: ' + strokeWeight + 'px;"><v:fill color="#999" type="tile" style="behavior: url(#default#VML);" /></v:roundrect>';
		*/
	}else if(jQuery.browser.mozilla){
		jQuery(e).css("-moz-border-radius",o.radius+"px");
	}else if(jQuery.browser.safari){
		jQuery(e).css("-webkit-border-radius",o.radius+"px");
	}else{
		jQuery(e).css("border-radius",o.radius+"px");
	}
	return e;
}
jQuery.extend({
	intval: function(v) {
        v = parseInt(v);
        return isNaN(v) ? 0 : v;
    },
    guid: function(){
		var result, i, j;
		result = '';
		for(j=0; j<32; j++)
		{
			if( j == 8 || j == 12|| j == 16|| j == 20)
			result = result + '-';
			i = Math.floor(Math.random()*16).toString(16).toUpperCase();
			result = result + i;
		}
		return result
	} 
});
