//避免$变量冲突
jQuery.noConflict();

//定义rekoo命名空间、常量
var rekoo={};
rekoo.union={};

rekoo.base_url='http://www.rekoo.com/';
rekoo.album_img_dir='http://f.rekoo.com/upload';
rekoo.union.base_url='http://union.rekoo.com/';


/*
rekoo.base_url='http://localhost:8000/';
rekoo.album_img_dir='http://localhost:8000/upload';
rekoo.union.base_url='http://localhost:8000/';
*/

/*
rekoo.base_url='http://2.net:8000/';
rekoo.album_img_dir='http://2.net:8000/upload';
rekoo.union.base_url='http://2.net:7000/';
*/

var __userAgent = navigator.userAgent.toLowerCase();
rekoo.isIE = /msie/.test( __userAgent ) && !/opera/.test( __userAgent );


rekoo.load_js=function(js){
	document.write(unescape("%3Cscript  charset='utf-8' type='text/javascript' src='"+rekoo.base_url+"static/js/bullfight/"+js+"'%3E%3C/script%3E"));
}

rekoo.load_css=function(css){
	document.write(unescape("%3Clink href='"+rekoo.base_url+"static/css/bullfight/"+css+"' rel='stylesheet' type='text/css' /%3E"));
}
rekoo.load_css('ver2_0/union.css');
rekoo.load_js('ver2_0/blockUI.js');

//联盟相册保存
rekoo.remote_ajax=function(url,callback,params){
   var s=document.createElement('script');
   s.setAttribute('type','text/javascript');
   s.setAttribute('charset','utf-8');
   
   if(url.indexOf('?')==-1)
	   s.src=url+"?callback="+callback+'&timestamp='+new Date();
   else
	   s.src=url+"&callback="+callback+'&timestamp='+new Date();
   if(params){
	   params=jQuery.param(params);
	   s.src+="&"+params;
   }
   document.getElementsByTagName('head')[0].appendChild(s);
   return s;
}

rekoo.scaleImage = function(ImgD,FitWidth,FitHeight){
	var width = ImgD.width;
	var height = ImgD.height;
	if(ImgD.width>FitWidth){
		ImgD.width=FitWidth;
		ImgD.height=(height*FitWidth)/width;
		width = ImgD.width;
		height = ImgD.height;
	}
	if(ImgD.height>FitHeight){
		ImgD.height=FitHeight;
		ImgD.width=(width*FitHeight)/height;
	}
};

rekoo.copy=function(vars, note) { 
	var el=document.getElementById(vars);
	el.select();
	vars=el.value;
	note = note || "复制成功!"; 
	if (!window.clipboardData) { 
		alert("抱歉，目前该功能只支持IE浏览器"); return false; 
		} 
		var c = window.clipboardData.setData("text", vars);
		if (note && c) { alert(note); } 
		else { 
			alert("由于您的浏览器安全级别设置不允许脚本复制系统帮您复制失败，请手动复制吧 :(");
		}
}
