﻿// JavaScript Document
function $c(str){
	var r = navigator.userAgent,
		isIE = (/msie/i.test(r) && !/opera/i.test(r)); 
	//
	if(!isIE){
		try{ console.log(str) }catch(e){};
	}else{
		//alert(str);
	}
}

var $$ = {
	incForm : function(){
		$('.__incForm').
		each(function(i, el){
			var el = $(this),
				id = el.attr('id'),
				val = el.html(),
				iframe= document.createElement('iframe'),
				src = "core/form.asp?id="+ id +(val?('&val='+val):'');
			//
			iframe.id = id;
			iframe.name = id;
			iframe.width = '100%';
			iframe.frameBorder = '0';
			iframe.scrolling = 'no';
			iframe.src = src;
			//
			el.after(iframe);
			el.remove();
		})
	}
	
	,page: function(){ //获取文件名
		var hrefArray = window.location.href.split('/'),
			pagename = hrefArray[hrefArray.length-1];
		return pagename.replace(/\%20/g,' ');
	}()
	
	,center: function(selector, top, left){
		var selector = (typeof(selector)=='string' ? $(selector) : selector);
		//
		selector.each(function(i,o){
			$(o).css("top",(top || ($(document).height())/2-(parseInt($(o).height())/2))+"px");
			$(o).css("left",(left || ($(document).width())/2-(parseInt($(o).width())/2))+"px");
		});
	}
}
