function AddOneStat(){
	var d=document;
	var sid="201324";
	var CONTENTSECTION="";
	var osp_URL=d.URL;
	var osp_Title=d.title;
	var t=new Date();
	var p="http"+(d.URL.indexOf('https:')==0?'s':'')+"://stat.onestat.com/stat.aspx?tagver=2&sid="+sid;
	p+="&url="+escape(osp_URL);
	p+="&ti="+escape(osp_Title);
	p+="&section="+escape(CONTENTSECTION);
	p+="&rf="+escape(parent==self?document.referrer:top.document.referrer);
	p+="&tz="+escape(t.getTimezoneOffset());
	p+="&ch="+escape(t.getHours());
	p+="&js=1";
	p+="&ul="+escape(navigator.appName=="Netscape"?navigator.language:navigator.userLanguage);
	if(osp_URL!=d.URL) p+="&ol="+escape(d.URL);
	if(typeof(screen)=="object"){
		p+="&sr="+screen.width+"x"+screen.height;p+="&cd="+screen.colorDepth;
		p+="&jo="+(navigator.javaEnabled()?"Yes":"No");
	}
	d.write('<img id="ONESTAT_TAG" border="0" width="1" height="1" src="'+p+'" style="display:none;">');
}

MainFormHelper = function(){
	this.cur_caseStudy = "";
	this.currentpopup = "";
}

MainFormHelper.prototype = {
	getVariable: function (varName){
		var arg = location.search.substring(1).split('&');
		var variable = "";		
		for(var i=0; i<arg.length; i++){
			if(arg[i].split('=')[0] == varName){
    			if(arg[i].split('=').length > 1){
        			variable = arg[i].split('=')[1];
				}
				return variable;
			}
		}
		return "";
	},
	displayCareer: function(jq_clientId, classname){
		jQuery('.' + classname).addClass("notvisible");
		jQuery(jq_clientId).removeClass("notvisible");
	},
	
	selectIndustryApplication: function (cur_obj, app_id, ind_id, button_id ){
		var app_obj = document.getElementById(app_id);
		var ind_obj = document.getElementById(ind_id);
		var button_obj = document.getElementById(button_id);		
		var selValue = '#' + cur_obj.options[cur_obj.selectedIndex].value;				
		
		jQuery( selValue).removeClass("notvisible");
		jQuery(this.cur_caseStudy).addClass("notvisible");		
		this.cur_caseStudy = selValue;
		
		if(cur_obj.id == app_id) {
			ind_obj.selectedIndex = 0;
		}else{
			app_obj.selectedIndex = 0;
		}	    
		if(selValue != '#Industry' && selValue != '#Application'){
			button_obj.style.display = "block";
		}else{
			button_obj.style.display = "none";
		}
	},
	
	searchOnKeyDown: function(event, nameButton){
		var key = event.keyCode;
		if(key == 13){
			document.getElementById(nameButton).click();
			return false;
		}        
	},	
	
	set_MaxHeight: function(clientId){
		var obj = document.getElementById(clientId);
		var diffHeight  = screen.availHeight - document.body.scrollHeight;
		if(obj != null && diffHeight > 0){
			var newsize = document.documentElement.clientHeight - 180;        
			obj.height = newsize;                
		}
	},
	
	_createString: function(width,height){
		var str = 'top='+(screen.height/2-height/2)+',left='+(screen.width/2-width/2)+',height='+height+',width=' +width +',status=no,toolbar=no,menubar=no,location=no';
		return str;
	},
	
	showGiftCard: function(){		    
		window.open('/usergroup/solution-seeker-contest.htm','Contest', this._createString(580,600));
	},

	showRLNote: function(isVisible, nameDiv){
		if(isVisible){
			if(document.getElementById(this.currentpopup) != null && document.getElementById(this.currentpopup) != undefined){
				document.getElementById(this.currentpopup).style.display = "none";
			}
			document.getElementById('DivPopup').style.display = "block";
			document.getElementById(nameDiv).style.display = "block"; 
			this._movePopupDiv();  
			this.currentpopup = nameDiv;
		}else{
			document.getElementById('DivPopup').style.display = "none";
		}
	},

	_movePopupDiv: function(){
		var popupDiv = document.getElementById('DivPopup');    
		popupDiv.style.left = screen.width / 2 - 100 + "px";
		popupDiv.style.top = screen.height / 2 - 130 + "px";
	}

}
var mainFormHelper = new MainFormHelper();

//stub
function ShowGiftCard(){
	mainFormHelper.showGiftCard();
}

function getPageMaxSize(){
	 return Math.max(
			document.documentElement["clientHeight"],
			document.body["scrollHeight"], document.documentElement["scrollHeight"],
			document.body["offsetHeight"], document.documentElement["offsetHeight"]
		);
}

function getMaxSize(objId){
	var obj = document.getElementById(objId);	 
	 return Math.max(obj["clientHeight"], obj["scrollHeight"], obj["offsetHeight"]);
}

function Resize(){
	var width_page = getPageMaxSize();	
	var width_tbl = getMaxSize('resizeableTable');	
	if(width_page > width_tbl){
		var footer = document.getElementById('resizeableFooter');
		footer.style.height = (jQuery(footer).height() + (width_page - width_tbl)) + "px";
	}
}
