/**
 * Copyright ©2010 http://www.profero.com.cn/sh/
 * Tel. +86 21 3331 5198   Fax. +86 21 3331 5197
 *
 * Profero Javascript Library, based on Jquery
 * @version 1.2
 *
 * @author gorden.xie@profero.com  msn:igorden8@hotmail.com
 * 
 * @Last Update Date: 2010-12-21  
 **/



//basic and common items here 
(function($){
	
/* plugin Template

(function($){
	
	$.fn.pluginName=function(params){
		
		params = $.extend({}, $.fn.pluginName.defaults, params);
		
		return false;	
	};
	$.fn.moveMiddle.defaults = {
		 
	};
	
})(jQuery);

*/


	$.profero={};
	
	//check IE
	$.profero.isIE =!$.support.opacity;
	
	//check IE6
	$.profero.isIE6 = $.profero.isIE && !window.XMLHttpRequest;
	
	//divide number with ","  
	// $.profero.number3(1234567) , return 1,234,567
	$.profero.number3=function(num){
		var reg=/(\d)(?=(\d{3})+$)/g;
		var str=num.toString().replace(reg,'$1,');
		return str;
	}
	
	$.profero.getQueryString=function(name){
	
		//if the required params not exist, return empty
		
		if(location.href.indexOf("?")==-1 || location.href.indexOf(name+'=')==-1)
		
		{
		
		return '';
		
		}
		
		// get the part of params of url
		
		var queryString = location.href.substring(location.href.indexOf("?")+1);
		
		 
		
		// split params
		
		var parameters = queryString.split("&");
		
		 
		
		var pos, paraName, paraValue;
		
		for(var i=0; i<parameters.length; i++)
		
		{
		
		// get the position of '='
		
		pos = parameters[i].indexOf('=');
		
		if(pos == -1) { continue; }
		
		 
		
		// get params name and value
		
		paraName = parameters[i].substring(0, pos);
		
		paraValue = parameters[i].substring(pos + 1);
		
		 
		
		// if find the params name required, return it's value
		
		if(paraName == name)
		
		{
		
		return unescape(paraValue.replace(/\+/g, " "));
		
		}
		
		}
		
		return '';
	
	}; 

	 
})(jQuery);


/*

make element vertical-align to their parents;
$('.gThumbCarouselItem').moveMiddle({method:'padding-top',offset:10});

*/

(function($){
	
	$.fn.moveMiddle=function(params){
		
		params = $.extend({}, $.fn.moveMiddle.defaults, params);
		
		var parentHeight=this.parent().height();
		var thisHeight=this.height();
		var heightDiff=(parentHeight-thisHeight)/2;
		var diffOffset=params.offset;
		
		
		this.css(params.method,heightDiff+diffOffset);
		
		return false;	
	};
	$.fn.moveMiddle.defaults = {
		method:'margin-top',
		offset:0
	};
	
})(jQuery);
 
 //communicate with remote ashx by ajax ==============================
 /*
 sample1: submit form fields to remote
 $(".gSubmitFrame").gSubmit(
	{
		url:"http://anjianji.w43.mc-test.com/WW/uk.ashx",
		setParams:{action:"insertregist"},
		loadingIcon:"#loadingSubmit",
		submitBtn:".gSubmitBtn",
		statusInfo:"#popupinfo",
		successInfo:"<font color=green><b>注册成功，谢谢.</b></font>",
		failInfo:"<font color=red><b>注册失败，请稍候再试。</b></font>",
		successFnInsert:testFn
	}
);
sample2: get json from remote
$("#btnRegist").gSubmit(
	{
		url:"http://heej.w45888.mc-test.com/heej.ashx",
		setParams:{action:"contentbyid",contentid:30},
		successFn:testFn
	}
); 

var testFn=function(json){
	alert(json.msgboard[0].title);
}
			
*/

 (function($){
	$.fn.gSubmit=function(params){
	 	
		//url to post params with callback
		var url=params.url+"?callback=?"; 
	 	
		//params mannualy specified
		var tempParms1=params.setParams; 
		
		//selector(id of class) of loading pic such as loading.gif
		//it will be displayed when submit and will be hidden when complete (defaultCallBackFn();)
		var loadingIcon=params.loadingIcon; 
		
		//selector of submit button
		//it will be hidden when complete (defaultCallBackFn();)
		var submitBtn=params.submitBtn; 
		
		//selector of form from which input fields will be submited
		var submitForm=params.submitForm;
		if(submitForm == null || submitForm==""){
			submitForm=this;	//$("#myForm").gSubmit({...});
		}
		
		//selector of element that will hold the status info such as "submit successfully!" 
		var statusInfo=params.statusInfo;
		
		//text content of success info such as "submit successfully!" 
		var successInfo=params.successInfo;
		
		//text content of fail info such as "submit failed!" 
		var failInfo=params.failInfo;
		
		//custom complete callback function, 
		//it will replace the default complete call back function defaultCallBackFn();
		var successFn=params.successFn;
		
		//custom expand of default complete call back function defaultCallBackFn();
		//it will keep the defaultCallBackFn(), and add additional function into defaultCallBackFn()
		var successFnInsert=params.successFnInsert;
		 
		//get values of all input fields , which is going to be submited to remote.
		var tempParams = {};
		$.each($(submitForm).serializeArray(), function(i, field) {
			tempParams[field.name] = field.value.replace(/\s/g,"").replace(/\'/g,"").replace(/\"/g,"");
		}); 
		
		//merge mannually inputed params and values of input files together .
		$.extend(tempParams, tempParms1);
	 	
		//public variable of complete callback fn
		var callbackFn;
		 
		//default complete callback fn 
		var defaultCallBackFn=function(json){ 
		 
			$(statusInfo).show();
			$(loadingIcon).hide();	
	
			if(json.msgboard[0].message!="1"){
				$(statusInfo).html(failInfo).show();
			}else{  
				$(statusInfo).html(successInfo).show();
			} 
	
			//expand complete callback fn  
			if(successFnInsert!=null && successFnInsert!=""){
				successFnInsert(json);
			}
			$("#btnSubmit").trigger("hello",json); 
		} 
		
	 	//use custom complete callback fn to replace the default one
		if(successFn==null || successFn==""){
			callbackFn=defaultCallBackFn;
		}else{
			callbackFn=successFn;	
		}
	 
		$(loadingIcon).show();	
		$(submitBtn).hide();
		
		//submit params and get json data and run callback fn when complete	
		$.getJSON(url,tempParams,callbackFn) ;
			 
		
		
		return false;
	};
})(jQuery);



//input fields validator==================================
 
/* sample
var isErr=$("#myForm").gValidator({});
*/
 
 
 (function($){
	$.fn.gValidator=function(params){
		
		//get from id
	 	var formName=$(this).attr("id");
		 
		if(formName==""){
			alert("please give your form an ID");
			return false;	
		}
		formName="#"+formName;
		
		var isErr=false;
		
		//launch validator
		checkField();
		
		//on blur, launch validator
		$(formName + ' .text.required').live("blur",function(){
			checkField()
		});
		
		//validator
		function checkField(){ 
			$.each($(formName + ' .text.required'), function(i,n){
				vRequired($(this).children("input"));
			}); 
			$.each($(formName + ' .text.email'), function(i,n){
				vEmail($(this).children("input"));
			}); 
			$.each($(formName + ' .text.chinaMobile'), function(i,n){
				vChinaMobile($(this).children("input"));
			}); 
			$.each($(formName + ' .checkbox.shouldCheck'), function(i,n){
				vCheckbox($(this).children("input"));
			}); 
			$.each($(formName + ' .dropdown.notFirst'), function(i,n){
				 
				vDropdown($(this).children("select"));
			}); 
		}
		
		//validate required field
		function vRequired(obj){
			var tempVal=obj.val().replace(/(^\s*)|(\s*$)/g, "");
			if(tempVal=="" || tempVal==null){
				obj.addClass("err");	
				isErr=true;
			}else{
				obj.val(tempVal);
				obj.removeClass("err");	
			}
		}
		
		//validate email field
		function vEmail(obj){
			var tempVal=obj.val().replace(/\s/g,"").replace(/ /g,"");
			if(!tempVal.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/)){
				obj.addClass("err");	
				isErr=true;
			}else{
				obj.val(tempVal);
				obj.removeClass("err");	
			}
		}
		
		//validate chinamobile field
		function vChinaMobile(obj){
			var tempVal=obj.val().replace(/\s/g,"").replace(/ /g,"");
			if(!tempVal.match(/^(13[0-9]|15[0-9]|18[0-9])\d{8}$/) || tempVal==""){
				obj.addClass("err");	
				isErr=true;
			}else{
				obj.val(tempVal);
				obj.removeClass("err");	
			}
		}
		//validate checkbox field
		function vCheckbox(obj){
			var tempVal=obj.attr('checked');
			if(!tempVal){
				obj.parent().children('label').addClass("err");	
				isErr=true;
			}else{
				//obj.val(tempVal);
				obj.parent().children('label').removeClass("err");	
			}
		}
		 
		function vDropdown(obj){
			var tempVal=obj.val();
			var tempVal2=obj.children("option").eq(0).text();
			 
			if(tempVal==tempVal2){
				obj.addClass("err");	
				isErr=true;
			}else{
				//obj.val(tempVal);
				obj.removeClass("err");	
			}
		}
	
	
	
		//return boolean result true==error, false==pass
		return isErr;
	};
})(jQuery);


//Carousel=============================================
/*

$("#myCarouselFrame").gCarousel();
$("#myThumbFrame").gThumbCarousel();

<div id="myCarouselFrame">
    <div id="myFrame" class="carouselMainFrame">
        <div class="gCarouselItem">1</div>
        <div class="gCarouselItem">2</div>
        <div class="gCarouselItem">3</div>
        <div class="gCarouselItem">1</div>
        <div class="gCarouselItem">2</div>
        <div class="gCarouselItem">3</div>
        <div class="gCarouselItem">1</div>
        <div class="gCarouselItem">2</div>
        <div class="gCarouselItem">3</div>
    </div>
    <div id="myThumbFrame" class="carouselThumbFrame">
        <div class="gThumbCarouselItem">111111</div>
        <div class="gThumbCarouselItem">222222</div>
        <div class="gThumbCarouselItem">333333</div>
        <div class="gThumbCarouselItem">111111</div>
        <div class="gThumbCarouselItem">222222</div>
        <div class="gThumbCarouselItem">333333</div>
        <div class="gThumbCarouselItem">111111</div>
        <div class="gThumbCarouselItem">222222</div>
        <div class="gThumbCarouselItem">333333</div>
    </div>
    <br />
    <div class="gCarouselNext">NEXT</div>
    <br />
    <div class="gCarouselPrevious">PREVIOUS</div>
    <br />
    <div class="gCarouselStart"></div>
    <br />
    <div id="myPage"><span class="carouselCurrentPage"></span>/<span class="carouselTotalPage"></span></div>
    
 
</div>

#myFrame{width:500px;height:300px;background:#eee;position:relative;}
 
.gCarouselNext{cursor:pointer;}
.gCarouselPrevious{cursor:pointer;}
.gCarouselItem{width:200px;display:none;position:absolute;}
.gCarouselFrame{overflow:hidden;}
.gCarouselBoard{position:relative;background:#fee;}

#myThumbFrame{width:500px;height:80px;background:#eef;position:relative;}
 
.gThumbCarouselItem{width:100px;display:block;float:left;position:relative;background:#efe;cursor:pointer;height:80px;}
.gThumbCarouselItem.activeThumb{background:#aaa;}
 

*/

(function($){
	
	
	
	

	$.fn.gCarousel = function(params) {  
	
		params = $.extend({}, $.fn.jScrollPane.defaults, params);
		
		//get carouselFrame id
		var carouselFrameName=$(this).attr("id");
		 
		if(carouselFrameName==""){
			alert("please give your carouselFrame an ID");
			return false;	
		}
		carouselFrameName="#"+carouselFrameName;
		
		//get carouselFrame object
		var carouselMainFrame=$(carouselFrameName +" .carouselMainFrame");
		 
		//initiate current item id
		var currentItemId=0;
		
		//get the dimension of carousel main space
		var frameWidth=$(carouselFrameName +" .carouselMainFrame").width();
		var frameHeight=$(carouselFrameName +" .carouselMainFrame").height();
		
		//get item group 
		var items=$(carouselFrameName +" .carouselMainFrame .gCarouselItem");
		
		//get thumb group
		var thumbItems=$(carouselFrameName +" .carouselThumbFrame .gThumbCarouselItem");
		
		//set height of each item
		$(items).css("height",frameHeight);
		
		//initiate the start X position of each item
		$(items).show().css("left",(frameWidth+20)+"px");
		
		//initiate X position of the first item
		$(items[0]).css("left",0+"px");
		
		//get items width
		var itemWidth=items.width();
		
		//get number of items
		var itemNum=items.length;
		
		//initiate the sum of width of all items
		var totalWidthofItems=0;
		 
		//write total page number
		$(carouselFrameName+' .carouselTotalPage').html(itemNum);
		//refresh current page number
		$(carouselFrameName+' .carouselCurrentPage').bind("changePage",function(){
			$(this).html(currentItemId+1);
		});
		//trigger to refresh current page number to initiate the current page number
		$.event.trigger("changePage");
		//on click in the carousel space, trigger to refresh current page number
		this.click(function(){
			$.event.trigger("changePage");
		});
		
		//caculate the sum of width of all items
		$.each(items,function(i,n){
			totalWidthofItems+=($(n).width());	
		});
		
		//left css set overflow:hidden
		carouselMainFrame.addClass("gCarouselFrame");
		
		//make a wrapper to wrap all items
		carouselMainFrame.wrapInner('<div class="gCarouselBoard" />');
		
		//set wrapper dimension
		carouselMainFrame.children(".gCarouselBoard").css("width",totalWidthofItems).css("height",frameHeight);
	 	
		//on click next button 
		$(carouselFrameName +" .gCarouselNext").click(function(){
			if(params.animation.indexOf('left')>=0){
				$(items[currentItemId]).animate({left:(frameWidth+10)*(-1)},params.duration,function(){
					
				});
			}
			if(params.animation.indexOf('fade')>=0){
	 
				$(items[currentItemId]).fadeOut(params.duration);
			}
			//get id of next item
			var nextItemId=getNextItemId(currentItemId,itemNum);
			
			if(params.animation.indexOf('left')>=0){
				//initiate the X start position of next item
				$(items[nextItemId]).css("left",frameWidth+10);
				$(items[nextItemId]).animate({left:0},params.duration,function(){
					 
				});
			}
			if(params.animation.indexOf('fade')>=0){
				$(items[nextItemId]).css("left",0);
				$(items[nextItemId]).hide();
				$(items[nextItemId]).fadeIn(params.duration);
			}
			currentItemId=nextItemId;
			
			//simulate thumb click to trigger the thumb moving
			$(thumbItems[currentItemId]).trigger("click");
		});
		
		//on click previous button
		$(carouselFrameName +" .gCarouselPrevious").click(function(){
			if(params.animation.indexOf('left')>=0){
				$(items[currentItemId]).animate({left:frameWidth+10},params.duration,function(){
					
				});
			}
			if(params.animation.indexOf('fade')>=0){
	 
				$(items[currentItemId]).fadeOut(params.duration);
			}
			//get id of previous item
			var nextItemId=getPreviousItemId(currentItemId,itemNum);
			
			
			if(params.animation.indexOf('left')>=0){
				//initiate the X start position of next item
				$(items[nextItemId]).css("left",(frameWidth+10)*(-1));
				$(items[nextItemId]).animate({left:0},params.duration,function(){
					
				});
			}
			if(params.animation.indexOf('fade')>=0){
				$(items[nextItemId]).css("left",0);
				$(items[nextItemId]).hide();
				$(items[nextItemId]).fadeIn(params.duration);
			}
			currentItemId=nextItemId;
			
			//simulate thumb click to trigger the thumb moving
			$(thumbItems[currentItemId]).trigger("click");
		});
		
		//on thumb click , if have thumb
		$(thumbItems).click(function(){
			
			//get current id of thumb items
			var thumbItemsId=$(thumbItems).index(this);
			
			//set items style
			$(thumbItems).removeClass("activeThumb");
			$(thumbItems[thumbItemsId]).addClass("activeThumb");
			
			//if click the current thumb, don't do anything
			if(thumbItemsId==currentItemId){return false;} 
			
			//determing the direction of animation
	 		if (thumbItemsId>=currentItemId){
				if(params.animation.indexOf('left')>=0){
					$(items[currentItemId]).animate({left:(frameWidth+10)*(-1)},params.duration,function(){
						
					});
				}
				if(params.animation.indexOf('fade')>=0){
	 
					$(items[currentItemId]).fadeOut(params.duration);
				}
				var nextItemId=thumbItemsId;
				if(params.animation.indexOf('left')>=0){
					$(items[nextItemId]).css("left",frameWidth+10);
					$(items[nextItemId]).animate({left:0},params.duration,function(){
				
					});
				}
				if(params.animation.indexOf('fade')>=0){
					$(items[nextItemId]).css("left",0);
					$(items[nextItemId]).hide();
					$(items[nextItemId]).fadeIn(params.duration);
				}
				currentItemId=nextItemId;
			}else{
				if(params.animation.indexOf('left')>=0){
					$(items[currentItemId]).animate({left:(frameWidth+10)},params.duration,function(){
						
					});
				}
				if(params.animation.indexOf('fade')>=0){
	 
					$(items[currentItemId]).fadeOut(params.duration);
				}
				var nextItemId=thumbItemsId;
				if(params.animation.indexOf('left')>=0){
					$(items[nextItemId]).css("left",(frameWidth+10)*(-1));
					$(items[nextItemId]).animate({left:0},params.duration,function(){
				
					});
				}
				if(params.animation.indexOf('fade')>=0){
					$(items[nextItemId]).css("left",0);
					$(items[nextItemId]).hide();
					$(items[nextItemId]).fadeIn(params.duration);
				}
				currentItemId=nextItemId;
			}
			
		});
		
		
		//$(carouselFrameName +" .gCarouselNext").trigger("click");
				
		//get next and previous item id by current id
		function getNextItemId(currentItemId,maxItem){
			return((currentItemId+1+maxItem)%maxItem);
		}
		function getPreviousItemId(currentItemId,maxItem){
			return((currentItemId-1+maxItem)%maxItem);
		}
		
		$.fn.jScrollPane.defaults = {
		 	duration:500,
			animation:"left"
		};
		
		return this;
	};
})(jQuery);

//Thumb Carousel based on gCarousel()========================================

(function($){
	
	
	
	$.fn.gThumbCarousel = function(params) {  
		
		params = $.extend({}, $.fn.gThumbCarousel.defaults, params);
		//get thumb frame name
		var carouselThumbFrameName=$(this).attr("id");
		 
		if(carouselThumbFrameName==""){
			alert("please give your carouselThumbFrame an ID");
			return false;	
		}
		carouselThumbFrameName="#"+carouselThumbFrameName;
		
		
		var currentItemId=0;
		var frameWidth=this.width();
		var frameHeight=this.height();
		var items=$(carouselThumbFrameName+" .gThumbCarouselItem");
		 
		$(items).show();
	 
	 
		var itemNum=items.length;
		var totalWidthofItems=0;
		 
		$(items[0]).addClass("activeThumb"); 
		
		$.each(items,function(i,n){
			$(n).height($(n).height()+params.thumbItemHeightOffset);
			$(n).width($(n).width()+params.thumbItemWidthOffset);
			totalWidthofItems+=($(n).width());	
		});
		
		this.addClass("gCarouselFrame");
		this.wrapInner('<div class="gCarouselBoard" />');
		var thumbBoard=$(carouselThumbFrameName+" .gCarouselBoard");
		
		var widthDiff=totalWidthofItems-frameWidth;
		var widthDiffStep=widthDiff/(itemNum-3);
		
		$(thumbBoard).css("width",totalWidthofItems).css("height",frameHeight);
		 
		$(items).click(function(){
			var itemsId=$(items).index(this);
			
			//move thumb board when thumb clicked
			if (itemsId>=0 && itemsId<=itemNum-1) {
				
				//when first and last item clicked, don't move
				if(itemsId==0){itemsId=1;}
				if(itemsId==itemNum-1){itemsId=itemNum-2;}
				
				$(thumbBoard).animate({left:widthDiffStep*(itemsId-1)*(-1)},500,function(){
					
				});
			}
		});
		
		return this;
	};
	
	$.fn.gThumbCarousel.defaults = {
		thumbItemWidthOffset:0,
		thumbItemHeightOffset:0
	};
	
})(jQuery);

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

//gateway===================================================
if($.cookie('age') == null ){
	$.cookie('from', window.location); 
	var AllVars = window.location.search.substring(1);
	window.location = 'gateway.html'+'?'+AllVars;
	}

//tracking event===================================================
(function($){
	$.fn.proferoLinkTrack=function(infoAttr,splitChar,gaAccount){
		 $(this).each(function(i,n){
			$(n).click(function(){
				 
				var infoArr= $(n).attr(infoAttr).split(splitChar);
				var category='';
				var action='';
				try{
					category=infoArr[0];
					action=infoArr[1];	
				}catch(err){
					console.log('attribute for category and action is error');
				}
				var href=$(n).attr('href');
				var target=$(n).attr('target');
				
				var pageTracker=_gat._getTracker(gaAccount); 
				pageTracker._trackEvent(category, action);

				if(target!='_blank' && target!='_new'){
					if(href!=null && href!=""){
					setTimeout('document.location = "' + href + '"', 300);
					return false;
					}
				}
				
			});
		}); 
	}
})(jQuery);	
