﻿/*----------------------------------------
Preset Values
----------------------------------------*/
var PAGEW = 980;
var aniSpeed = {
	slow: 2000,
	med: 1000,
	fast: 500,
	flash: 200
};
/*----------------------------------------
Functions
----------------------------------------*/
//trim
function trim(str) {
var str = str.replace(/^\s\s*/, ''),
	ws = /\s/,
	i = str.length;
	while (ws.test(str.charAt(--i))){}
	return str.slice(0, i + 1);
}
//auiAjax
var auiAjax = {
	request: {},
	send: function(name, opt, des) {
		this.abort(name);
		this.request[name] = {des: des, body: $.ajax(opt)};
		return this.request[name].body;
	},
	abort: function(name) {
		if(this.request[name] != null) this.request[name].body.abort();
	}
};
//set input tips
function initInput() {
	$('input[type=text],textarea').each(function(){
		if(!$(this).attr('tips') || $(this).attr('tips') == '') return;
		$(this).focusin(function(){
			if($(this).val() == $(this).attr('tips')) $(this).val('').removeClass('inputTips');
			$(this).focus();
		});
		$(this).focusout(function(){
			if($(this).val() == '') $(this).val($(this).attr('tips')).addClass('inputTips');
		});
		if($(this).val() == '') $(this).focusout();
	});
}
/*----------------------------------------
Init
----------------------------------------*/
$(document).ready(function() {
	//section title animation
	setTimeout("$('.sectionTitle').css('opacity', 0).animate({opacity: 1}, aniSpeed.slow);", 1000);
	//init input
	initInput();
});
