////PNG FIX////
$(document).ready(function(){
	$("#page").pngFix();
});

$(document).ready(function(){
jQuery.preloadCssImages = function(){
        var allImgs = [];//new array for all the image urls 
        var k = 0; //iterator for adding images
        var sheets = document.styleSheets;//array of stylesheets
       
        for(var i = 0; i<sheets .length; i++){//loop through each stylesheet
                var cssPile = '';//create large string of all css rules in sheet
                var csshref = (sheets[i].href) ? sheets[i].href : 'window.location.href';
                var baseURLarr = csshref.split('/');//split href at / to make array
                baseURLarr.pop();//remove file path from baseURL array
                var baseURL = baseURLarr.join('/');//create base url for the images in this sheet (css file's dir)
                if(baseURL!="") baseURL+='/'; //tack on a / if needed
                if(document.styleSheets[i].cssRules){//w3
                        var thisSheetRules = document.styleSheets[i].cssRules; //w3
                        for(var j = 0; j<thisSheetRules.length; j++){
                                cssPile+= thisSheetRules[j].cssText;
                        }
                }
                else {
                        cssPile+= document.styleSheets[i].cssText;
                }
               
                //parse cssPile for image urls and load them into the DOM
                var imgUrls = cssPile.match(/[^\(]+\.(gif|jpg|jpeg|png)/g);//reg ex to get a string of between a "(" and a ".filename"
                if(imgUrls != null && imgUrls.length>0 && imgUrls != ''){//loop array
                        var arr = jQuery.makeArray(imgUrls);//create array from regex obj       
                        jQuery(arr).each(function(){
                                allImgs[k] = new Image(); //new img obj
                                allImgs[k].src = (this[0] == '/' || this.match('http://')) ? this : baseURL + this;     //set src either absolute or rel to css dir
                                k++;
                        });
                }
        }//loop
        return allImgs;
}
});

////PNG FIX CLOSE////

//// FORM VALIDATION  ////
//$(document).ready(function(){
//	$("#user-login").validate({
//		rules: {
//			name: "required",
//			pass: {
//				required: true,
//			},
//		},
//		messages: {
//			name: "Please enter a valid email address",
//			pass: {
//				minlength: "Your password must be at least 5 characters long"
//			}
//		}
//	});
//});
//
//
//$(document).ready(function(){
//	$("#user-pass").validate({
//		rules: {
//			name: "required"
//		},
//		messages: {
//			name: "Please enter a valid email address"
//			
//		}
//	});
//});
//
//
//
//$(document).ready(function(){
//	$("#user-register").validate({
//		rules: {
//			forename: "required",
//			surname: "required",
//			gender: "required",
//			name: "required",
//			tandc:"required",
//			mail: {required: true,  email: true },
//			"pass[pass1]": {
//				required: true
//			},
//			"pass[pass2]": {
//				required: true,
//				equalTo: '#pass[pass1]',
//			},
//			
//		},
//		messages: {
//			forename: "Please enter your for first name",
//			surname: "Please enter a your last name",
//			gender: "Please select a your gender",
//			"pass[pass1]": {
//				required: "Please provide a password",
//			},
//			"pass[pass2]": {
//				required: "Please provide a matching password",
//				equalTo: "Please enter the same password as above"
//			},
//			name: "Please enter a screen name",
//			mail: "Please enter a valid email",
//			tandc: "Please accept the Terms &amp; Conditions"
//		}
//	});
//});
//
//$(document).ready(function(){
//	$("#user-edit").validate({
//		rules: {
//			name: "required",
//			mail: {required: true,  email: true },
//			"pass[pass1]": {
//				required: true
//			},
//			"pass[pass2]": {
//				required: true,
//				equalTo: '#pass[pass1]',
//			},
//			
//		},
//		messages: {
//			forename: "Please enter your for first name",
//			"pass[pass1]": {
//				required: "Please provide a password",
//			},
//			"pass[pass2]": {
//				required: "Please provide a matching password",
//				equalTo: "Please enter the same password as above"
//			},
//			name: "Please enter a screen name",
//			mail: "Please enter a valid email",
//			}
//	});
//});

//// FORM VALIDATION CLOSE ////







//probably not needed
//$(document).ready(function(){
//    
//    $(".comment_wrapper .info .links a").click(function(){
//      if ( $("body").hasClass("not-logged-in") )
//      $(".comment_wrapper .info .links a").text("You must be logged on to flag comments");
//    return false; });
//
//  });

	

///////
//sifr_html = function(htmlOptions) {
//	htmlOptions.flashvars.txt = this.innerHTML;
//	this.innerHTML = '<div>'+this.innerHTML+'</div>';
	//var $alt = $(this.firstChild);
//	htmlOptions.height = $alt.height();
//	htmlOptions.width = $alt.width();
//	$alt.addClass('alt');
//	$(this)
//		.addClass('flash-replaced')
//		.prepend($.fn.flash.transform(htmlOptions));						

//sifr_html_no_div = function(htmlOptions) {
//	htmlOptions.flashvars.txt = this.innerHTML;
//	this.innerHTML = '<span>'+this.innerHTML+'</span>';
//	var $alt = $(this.firstChild);
//	htmlOptions.height = $alt.height();
//	htmlOptions.width = $alt.width();
//	$alt.addClass('alt');
//	$(this)
	//	.addClass('flash-replaced')
//		.prepend($.fn.flash.transform(htmlOptions));						
//}
////////
//$('h1.title, h2.title').flash(
//	{ 
	//	src: '../flash/sifr/gotham.swf', 
//		wmode: 'transparent',
	//	sCase: 'upper',
	//	flashvars: { 
	//		css: [
		//		'* { color: #FF0066; text-transform:uppercase;}'
		//	].join(' ')
		//}
	//},
//{ version: 7 }, sifr_html);
		
