/* return fullpath with lang */
function base_url()
{
	var hostName = document.location.hostname;
	var pathName = document.location.pathname;
	
	// get lang
	var temp = pathName.split('/');
	return 'http://' + hostName + '/' + temp[1] + '/';
}


function popWin(url,w,h) {
	var winl=(screen.width-w) / 2;
	var wint=(screen.height-h) / 2;
	var newWindow
	newWindow = window.open(url,"nWin","scrollbars=yes,status=no,location=no,toolbar=no,menubar=no,directories=no,resizable=yes,width="+w+",height="+h+",top="+wint+",left="+winl+"")
}


jQuery.fn.extend({
	embedSWF: function(settings , pluginOptions ){
			var o = jQuery.extend({ expressInstall:"js/swfobject/expressInstall.swf",version:'8.0.0'}, settings);
			if(swfobject.flagSwitchOff){
				swfobject.switchOffAutoHideShow();
				swfobject.flagSwitchOff = false;
			}
			for(var key in o.flashvars) o.flashvars[key] = encodeURIComponent(o.flashvars[key]);
			
			return this.each(function() {
				
				var swfId = this.id||("swfobject_"+Math.round(Math.random()* 1000));
				var swfName = this.name||swfId;
				var swfWidth = o.width||$(this).width();
				var swfHeight = o.height||$(this).height();
				swfobject.embedSWF(o.src, swfId, swfWidth, swfHeight, o.version,o.expressInstall ,o.flashvars,$.extend({wmode:o.wmode||"opaque"},o.params));
			});
		},
		doFocusInput:function(settings){
			return this.each(function() {
				var me = this;
				var options = jQuery.extend({
				defaultWord:this.defaultValue,
				focus:{
					border:"0",
					color:"#242424"
				},
				blur:{
					border:"0",
					color:"#B0B0B0"
				},
				alert:{
					border:"0",
					color:"#FF0000"
				}}, settings);
				$("form:has(#" + me.id + ")").bind("submit" , function(){
					var meValue = $( "#"+me.id , this).val();
				 	if( meValue == "" || meValue==options.defaultWord) {
						$(me).val(options.defaultWord)
						.css(options.alert);//.animate(options.focus,5000);
						return false;
					} 
				});
				$(this).css(options.blur)
				.bind("focus",function(){
					$(this).css(options.focus);
					
					if($.trim(this.value) == $.trim(options.defaultWord) ){
						this.value = "";
					}else {this.select();}
				})
				.bind("blur",function(){
					$(this).css(options.blur);
					if($.trim(this.value) == "" || $.trim(this.value) == options.defaultWord ){
						this.value = $.trim(options.defaultWord);
						$(this).css(options.blur);
					}else{
						this.style.color = options.focus.color;
					}
				});
			});
		}
});

function contactForm_Default(name,valueshow){
	var show_txt = $(name).val();
	if(show_txt == ""){
		$(name).val(valueshow);
	}
	$(name).click(function(){
		var show_set = $(name).val();
		if(show_set == valueshow){
			$(name).val("");
		}
	});
	$(name).blur(function(){
		var show_set = $(name).val();
		if(show_set == ""){
			$(name).val(valueshow);
		}
	});
}
