﻿//<![CDATA[
document.write('<script type="text/javascript" src="/js/swfobject.js"><\/script>');
document.write('<script type="text/javascript" src="/js/u_calendar.js"><\/script>');
document.write('<script type="text/javascript" src="/js/u_defaults.js"><\/script>');
document.write('<script type="text/javascript" src="/'+lang+'/js/u_lang.js"><\/script>');

var langArray = new Array('','en-gb','es','fr','de','it','nl','pt','ru','el','zh','zh-tw','ja','kr');
var langType = (langArray.indexOf(lang)<10) ? 0 : 1;	// 0: western/latin languages; 1: eastern/chinese languages
var startSection = langType;

// browser compatibility check
var browserName, browserVersion
function browserCheck() {
	var userAgentString = navigator.userAgent.toLowerCase();

	if (userAgentString.indexOf('msie')>-1) {
		var tmpIndex = parseInt(userAgentString.indexOf('msie')+5,10);
		browserName = "Internet Explorer";
		browserVersion = userAgentString.substring(tmpIndex, tmpIndex+3);
	} else if (userAgentString.indexOf('firefox')>-1) {
		var tmpIndex = parseInt(userAgentString.indexOf('firefox')+8,10);
		browserName = "Firefox";
		browserVersion = userAgentString.substring(tmpIndex, tmpIndex+3);
	} else if (userAgentString.indexOf('opera')>-1) {
		var tmpIndex = parseInt(userAgentString.indexOf('opera')+6,10);
		browserName = "Opera";
		browserVersion = userAgentString.substring(tmpIndex, tmpIndex+3);
	} else if (userAgentString.indexOf('chrome')>-1) {
		var tmpIndex = parseInt(userAgentString.indexOf('chrome/')+7,10);
		browserName = "Chrome";
		browserVersion = userAgentString.substring(tmpIndex, tmpIndex+10);
	} else if (userAgentString.indexOf('safari')>-1) {
		var tmpIndex = parseInt(userAgentString.indexOf('version')+8,10);
		browserName = "Safari";
		browserVersion = userAgentString.substring(tmpIndex, tmpIndex+3);
	}
};
browserCheck();
// ActiveX check
var isIE = (window.ActiveXObject) ? true : false;
var isIE6 = (browserName=="Internet Explorer" && parseInt(browserVersion,10)==6) ? true : false;
/* ===================================================================================================
// COMMON LOW-LEVEL FUNCTIONS
=================================================================================================== */
function openWindow(url,name,size) {
	switch(size) {
		case 'sml':
		var features = "scrollbars=yes,width=420,height=400,top=100,left="+(document.viewport.getWidth()/2+100);
	}
	window.open(url,name,features);
	void(0);
};
// add function to load event
function addLoadEvent(func) {
    var originalOnload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (originalOnload) {
                originalOnload();
            }
            func();
        }
    }
};
// add leading zeros for numbers less than 10
function addZero(n) {
	return n<10 ? "0"+n : n;
};
// adds double-byte spaces before different levels of options in a dropdown box
function addSpacing(number) {
	var chars="";
	for (var i=0; i<number; i++) {
		chars+="&emsp";
	}
	return chars;
};
// clean white-space nodes in xml files - used mostly for Mozilla/Firefox and Opera
function cleanWhitespaces(node) {
	for (var x=0; x<node.childNodes.length; x++) {
		var childNode = node.childNodes[x];
		if ((childNode.nodeType==3)&&(!(/\S/.test(childNode.nodeValue)))) {
			node.removeChild(childNode);
			x--;
		}
		if (childNode.nodeType==1) {
			cleanWhitespaces(childNode);
		}
	}
};
// toggle file listing views between preview mode (icon mode) and detail mode (list mode)
function toggleView(obj) {
	var output = document.forms["userFiles"].elements["view"];
	if ($('library').hasClassName("preview")) {
		$('library').className = output.value = "detail";
		obj.innerHTML="<img alt='"+py_TuBiaoLieBiao+"' title='"+py_TuBiaoLieBiao+"' src='/"+lang+"/skins/common/images/view_icons.gif' /><span>"+py_TuBiaoLieBiao+"</span>";
		
		
	} else {
		$('library').className =  output.value = "preview";
		obj.innerHTML="<img alt='"+py_XiangXiLieBiao+"' title='"+py_XiangXiLieBiao+"' src='/"+lang+"/skins/common/images/view_detail.gif' /><span>"+py_XiangXiLieBiao+"</span>";
		$$('div#library div.item')[0].style.borderTopWidth="0px";
	}
//Added by ewa wei
	//document.forms["userFiles"].submit();
};
// get unicode string length - double-byte caharacters count as 2;
function getStringLength(str) {
	var wid = arguments[1] ? arguments[1] : 2;
	var esc = escape(str);
	var uni = esc.split('%').length-1;
	return esc.length-uni*6+uni*wid;
}
// move cursor to certain position of an element
function setInputCaret(input,position) {
	if (input.createTextRange) {
		var range = input.createTextRange();
    	range.collapse(true);
	    range.moveEnd('character', position);
    	range.moveStart('character', position);
	    range.select();
	} else if (input.selectionStart) {
		input.startSelection=position;
		input.focus();
	}
};
// create a random text string using a-z and A-Z
function randomString(length) {
	var string = "";
	var charArray = new Array(65,97);
	for (var i=0; i<length; i++) {
		string += String.fromCharCode(Math.floor(Math.random()*26)+charArray[Math.round(Math.random())]);
	}
	return string;
};

function buildRater(obj,type,point,result,bool) {
	var tempPoint = point;
	var length = (point*starWidth)+"px";
	var baseLink = "/"+lang+"/skins/"+skin+"/images/"+type+"-";

	var stars = new Element('div',{className:'stars'});
	var rating = new Element('div',{style:'width:'+length+';'});

	stars.appendChild(rating);
	obj.appendChild(stars);
	obj.appendChild(new Element('span').update("&nbsp;"+ratingInstr));

	Event.observe(stars, 'mousemove', function(evt) {
		if (bool) {
			stars = Event.element(evt);
			var starsX = stars.cumulativeOffset().left;
			var mouseX = Event.pointerX(evt);
			rating.style.width=Math.ceil((mouseX-starsX)/starWidth)*starWidth+"px";
		} else {
			Event.stop(evt);
		}
	});

	var comment = document.forms['comment'];

	stars.onclick = function() {
		if (bool) {
			bool=false;
			var stars = this;
			var value = parseInt(rating.style.width,10)/starWidth;
			var parameterHash = new Hash();
			parameterHash.set('data[UserFile][id]',	comment.elements['data[UserFile][id]'].value);
			parameterHash.set('data[User][id]',	comment.elements['data[UserFile][id]'].value);
			parameterHash.set('data[UserFile][score]', value);
			parameterHash.set('t',(new Date()));

			new Ajax.Request('/user_files/score', {
				method: 'post',
				postBody: '',
				parameters: parameterHash,
				onCreate: function() {
					loading.show();
				},
				onSuccess: function(transport) {
					loading.hide();
					var data = transport.responseText.evalJSON();
					result.style.width=(parseFloat(data.score)*15)+"px";
					$('score').update(data.score);
					$('raters').update(data.raters);
					stars.style.cursor="default";
					tempPoint = value;
					obj.style.width=tempPoint*starWidth+"px";
				},
				onFailure: function() {
					bool=true;
				}
			});
		}
	};

};

function toggleRater(obj,point) {
	obj.style.width=point*starWidth+"px";
};
/*====================================================================================================
// AJAX
====================================================================================================*/
// initialize default values
var regions = $H({
	"default":"11",
	"mask":"x-x-xx-xx",
	"levels":"4",
	"table":"geo"
});

var occupations = $H({
	"default":"2021301",
	"mask":"x-xx-xx-xx",
	"levels":"4",
	"table":"job_occupations"
});

var industries = $H({
	"default":"G",
	"mask":"x-xx-x-x",
	"levels":"3",
	"table":"biz_industries"
});

var disciplines = $H({
	"default":"0812",
	"mask":"xx-xx-xx",
	"levels":"3",
	"table":"edu_disciplines"
});

var degrees = $H({
	"default":"7"
});

var psnInfo = $H({});
var resume = $H({});

var langs = $H({});
var lang_levels = $H({});
var lang_packs = $H({});

var jobs = $H({});
var fundings = $H({});
var scales = $H({});
var cycles = $H({});

var searchParams = new Array();
searchParams['regions'] = $H({
	'output':'data[Resume][areas_expect]',
	'selected':'selectedRegions',
	'full':true,
	'max':5
});
searchParams['occupations'] = $H({
	'output':'data[Resume][occupation_expect]',
	'selected':'selectedOccupations',
	'full':false,
	'max':5
});
searchParams['industries'] = $H({
	'output':'data[Resume][industries_expect]',
	'selected':'selectedIndustries',
	'full':false,
	'max':5
});
// function to mask value according to the positions of '-'
function maskValue(mask, value) {
	var maskArray = mask.split("-");
	var tempArray = new Array();
	var valuesArray = new Array();

	maskArray.each(function(i, index) {
		tempArray[index] = (index>0) ? i.length+tempArray[index-1] : i.length;
	});

	tempArray.each(function(i, index) {
		valuesArray[index] = value.toString().substring(0,i);
	});

	return {"values":valuesArray,"lengths":tempArray};
};
// function to return name from json
function getName(json,id) {
	var name = "&nbsp;";
	if (id) {
		json.each(function(i) {
			if (i.id==id) name=i.name;
		});
	}
	return name;
};
// reading AJAX files
new Ajax.Request('/'+lang+'/js/u_json.js', {
	method: 'get',
	onSuccess: function (transport) {
		var json = transport.responseText.evalJSON();
		fundings.set("json", json.fundings);
		industries.set("json", json.industries);
		scales.set("json", json.scales);
		degrees.set("json", json.degrees);
		disciplines.set("json", json.disciplines);
		jobs.set("json", json.jobs);
		langs.set("json", json.langs);
		lang_levels.set("json", json.lang_levels);
		lang_packs.set("json", json.lang_packs);
		occupations.set("json", json.occupations);
		regions.set("json", json.regions);

		psnInfo.set("ethnic", json.ethnic);
		psnInfo.set("genders", json.genders);
		psnInfo.set("marrital", json.marrital);
		psnInfo.set("political", json.political);

		cycles.set('json', json.subscriptions);
	}
});

new Ajax.Request('/'+lang+'/js/u_quik.js', {
	method: 'get',
	onSuccess: function (transport) {
		var json = transport.responseText.evalJSON();
		searchParams['regions'].set("chkbJSON", json.geo);
		searchParams['regions'].set("chkbHTML", 'cloneAreas');
		searchParams['occupations'].set("chkbJSON", json.occupations);
		searchParams['occupations'].set("chkbHTML", 'cloneOccupations');
		searchParams['industries'].set("chkbJSON", json.industries);
		searchParams['industries'].set("chkbHTML", 'cloneIndustries');
	}
});
// datepicker code;
var dpForm, dpCalendar;
new Ajax.Request('/js/u_datepicker.xml', {
	method: 'get',
	onSuccess: function(xmlHttpRequest) {
		var root = xmlHttpRequest.responseXML.getElementsByTagName("root").item(0);
		dpForm=root.getElementsByTagName("form").item(0).childNodes[0].nodeValue.replace(/skins\/skin/g, 'skins/'+skin);
		dpCalendar = (isIE6) ? "<iframe class='calendar' frameborder='no'></iframe>" : "";
		dpCalendar+=root.getElementsByTagName("calendar").item(0).childNodes[0].nodeValue.replace(/skins\/skin/g, 'skins/'+skin);
//		alert(dpCalendar);
	}
});
/* ===================================================================================================
// INITIALIZE FORMS
=================================================================================================== */
function toggleInstr(obj) {
	var instr;
	switch (obj.name) {
		case "searchKeywords":
			instr = keyInstr; break;
		case "data[User][email]":
			instr = emailInstr; break;
		case "data[User][passstring]":
			instr = passwordInstr; break;
		case "articleKeywords":
			instr = articleKeyInstr; break;
	}

	var input = obj.value.strip();
	if (obj.name=="searchKeywords" && input!="") {
		multiForm.elements['data[Resume][keywords]'].value=input;
	}

	if (input=="" || input==instr) {
		obj.value = instr;
		obj.style.color = "#999";
	} else {
		obj.value = input;
		obj.style.color = "#000";
	}
};

function togglePasswordInstr() {
	loginForm.elements['data[User][passstring]'].value = "";
	loginForm.elements['data[User][password]'].focus();
};

function resetPasswordInstr() {
	loginForm.elements['data[User][passstring]'].value="";
	if (loginForm.elements['data[User][password]'].value.strip()=="") {
		loginForm.elements['data[User][password]'].value="";
		loginForm.elements['data[User][passstring]'].value=passwordInstr;
	}
};

function loginOnEnter(evt) {
	if (Number(evt.keyCode)==13) {
		validateLogin();
	}
};

function validateLogin() {
	var loginEmail = loginForm.elements['data[User][email]'];
	var loginPassword = loginForm.elements['data[User][password]']

	if (loginEmail.value==emailInstr||!validateEmail(loginEmail)) {
		alert(msg_emailFormatIncorrect);
		loginEmail.focus();
	} else if (loginPassword.value==passwordInstr||loginPassword.value.length<6) {
		alert(msg_passwordLength);
		loginPassword.focus();
	} else {
		loginForm.submit();
	}
};
/* ===================================================================================================
// DISPLAY FUNCTIONS
=================================================================================================== */
var loading;
var multiForm;
var multiHTML;
var multiTitle;
var quickSearch;
var loginForm;
var searchForm;
var artSearchForm;

// display left and right wings
function wings() {
	var leftWing = new Element('div',{className:'wing',id:'leftWing'});
	var rightWing = new Element('div',{className:'wing',id:'rightWing'});
	document.body.appendChild(leftWing);
	document.body.appendChild(rightWing);
};

function fadeResizer() {
	var popupMargin=20;

	var popup = $$('div#multi div.popup')[0];
//	var windowWidth = (document.documentElement.clientWidth) ? (document.documentElement.clientWidth) : document.body.clientWidth;
	var windowHeight = (document.documentElement.clientHeight) ? (document.documentElement.clientHeight) : document.body.clientHeight;
	var scrollHeight = document.viewport.getScrollOffsets().top;
	var pageHeight = $('body').getHeight();

	var popupHeight = popup.getHeight();
//	$('rightWing').style.width = ((windowWidth-$('body').getWidth())/2+4)+"px";
	multiHTML.style.height = Math.max(windowHeight, pageHeight, popupHeight+2*popupMargin)+"px";

	if (windowHeight>(popupHeight+2*popupMargin)) {
		popup.style.top = (scrollHeight+(windowHeight-popupHeight)/2)+"px";
	} else {
		popup.style.top = popupMargin+"px";
		window.scrollTo(0,0);
	}
};

window.onload = function() {
	$('body').toggle();
	document.body.className = "normal";

	loading=$('loading');
	loading.hide();
	$(document.body).style.height=$('background').style.height=$('body').getHeight()+"px";

	wings();

	searchForm = document.forms['searchForm'];
	artSearchForm = document.forms['artSearchForm'];

// set error messages
	searchParams['regions'].set('error', msg_YouCanSelectMax+searchParams['regions'].get('max')+msg_ExtRegions);
	searchParams['occupations'].set('error', msg_YouCanSelectMax+searchParams['occupations'].get('max')+msg_ExtOccupations);
	searchParams['industries'].set('error', msg_YouCanSelectMax+searchParams['industries'].get('max')+msg_ExtIndustries);

//	loading.show();
	setTimeout('buildMulti()',10);

	$$('.button').each(function(i) {
		i.onmouseover = i.onmouseout = function() {
			this.roll();
		}
	});

// adds default input text to login and search forms
	if (loginForm) {
		loginForm.elements['data[User][email]'].value = emailInstr;
		loginForm.elements['data[User][password]'].value = "";
		loginForm.elements['data[User][passstring]'].value = passwordInstr;
		loginForm.elements['data[User][passstring]'].onfocus = function() {
			togglePasswordInstr();
		};
	}

	if (searchForm) {
		searchForm.searchKeywords.value = (searchKeywords=="") ? keyInstr : searchKeywords;
	}

	if (artSearchForm) {
		artSearchForm.articleKeywords.value = (articleKeywords=="") ? articleKeyInstr : articleKeywords;
	}
// user control panel icons
	if ($('control')) {
		$$('div#control div.icon').each(function(i, index) {
			if (langType) {
				var ico = i.select('img')[0];
				var icoPath = ico.src;

				var txt = i.select('img')[1];
				var txtPath = txt.src;

				if (index==currentController) {
					i.style.cursor = "default";
					ico.roll(false);
					txt.roll(false);
				} else {
					i.onmouseover = function() {
						this.style.left = this.style.top = "-1px";
						ico.roll();
						txt.roll();
					}

					i.onmouseout = function() {
						var state = "-out.";
						this.style.left = this.style.top = "0px";
						ico.roll();
						txt.roll();
					}
				}
			} else {
				var bg = i.style.backgroundImage;
				cleanWhitespaces(i);

				if (index==currentController) {
					i.style.cursor = "default";
					i.style.backgroundImage = i.style.backgroundImage.replace('-out.', '-over.');
//					i.firstChild.style.color = (i.firstChild.nodeName=="P") ? "#fff" : "";
				} else {
					i.onmouseover = function() {
						this.style.left = this.style.top = "-1px";
						i.style.backgroundImage = i.style.backgroundImage.replace('-out.', '-over.');
//						i.firstChild.style.color = (i.firstChild.nodeName=="P") ? "#fff" : "";
					}

					i.onmouseout = function() {
						this.style.left = this.style.top = "0px";
						i.style.backgroundImage = i.style.backgroundImage.replace('-over.', '-out.');
//						i.firstChild.style.color = (i.firstChild.nodeName=="P") ? "#000" : "";
					}
				}
			}
		});
	}
// initialize articles main page
	if ($('tabbings')) {
		tabResizer();
		tabSelector();
	}
// show default displaying FAQ
	var thisFilePath = window.location.toString();

	if (thisFilePath.indexOf("faqs")>-1) {
		var h = thisFilePath.toQueryParams();
		(h.type) ? toggleFAQSection(h.type) : toggleFAQSection('psn');
		(h.faq) ? toggleFAQs(h.type, h.faq) : toggleFAQs('psn',1);
	}
};
/* ===================================================================================================
// FUNCTIONS USED FOR GUEST PAGES
=================================================================================================== */
// toggle tab states "over" -> "out" or "out" -> "over"
var currentTab;
function toggleTab(obj, evt) {
	cleanWhitespaces(obj);
	if (obj.className=="sideTab sideTab-over" && evt.type=="mouseover") {
		currentTab=obj;
	}

	if (evt.type=="mouseover") {
		obj.firstChild.style.color = "#ff0000";
		obj.className = (obj==currentTab) ? obj.className : "sideTab sideTab-over";
	} else {
		obj.firstChild.style.color = "#000000";
		obj.className = (obj==currentTab) ? obj.className : "sideTab sideTab-out";
	}
};
// toggle page text size
function toggleFontSize(size) {
	var h1 = $A($('text').getElementsByTagName('h1'));
	h1.each(function(child) {
		child.style.fontSize = (size+4)+"px";
		child.style.lineHeight = (size+8)+"px";
		child.style.marginBottom = (size+8)+"px";
	});

	var h2 = $A($('text').getElementsByTagName('h2'));
	h2.each(function(child) {
		child.style.fontSize = (size+2)+"px";
		child.style.lineHeight = (size+6)+"px";
		child.style.marginBottom = (size+6)+"px";
	});


	var h3 = $A($('text').getElementsByTagName('h3'));
	h3.each(function(child) {
		child.style.fontSize = size+"px";
		child.style.lineHeight = (size+4)+"px";
		child.style.marginBottom = (size+4)+"px";
	});

	var p = $A($('text').getElementsByTagName('p'));
	p.each(function(child) {
		child.style.textIndent = size*2+"px";
		child.style.fontSize = size+"px";
		child.style.lineHeight = (size+4)+"px";
		child.style.marginBottom = (size+4)+"px";
	});
};

// toggle FAQ text size
function toggleFAQSize(size) {
	var li = $A($('text').getElementsByTagName('li'));
	li.each(function(child) {
		child.style.fontSize = size+"px";
		child.style.lineHeight = (size+4)+"px";
	});

	var a = $A($$('a[class="subject"]'));
	a.each(function(child) {
		child.style.fontSize = size+"px";
		child.style.lineHeight = (size+4)+"px";
		child.style.marginBottom = (size+4)+"px";
	});

	var p = $A($('text').getElementsByTagName('p'));
	p.each(function(child) {
		child.style.textIndent = size*2+"px";
		child.style.fontSize = size+"px";
		child.style.lineHeight = (size+4)+"px";
		child.style.marginBottom = (size+4)+"px";
	});

	var s = $A($('text').getElementsByTagName('strong'));
	s.each(function(child) {
		child.style.fontSize = size+"px";
	});
};
// resize the table height to match the tabs height
function tabResizer() {
	var tabs = $$('div#tabbings div#tabs')[0];
	var table = $$('div#tabbings div#table')[0];
	var div = $$('div#tabbings div#table div')[0];

	if (tabs.getHeight()>table.getHeight()) {
		div.style.height = tabs.getHeight()+"px";
	}
};
// initialize the tab
function tabSelector() {
	var tabText = $$('div#tabbings div#tabs div.sideTab span.keyword');
	tabText.each(function(i) {
		if (i.innerHTML.strip()==currentTab) {
			i.parentNode.className = "sideTab sideTab-over";
		}
	});
};

// toggle FAQs section
function toggleFAQSection(section) {
	var lnks = $$('div#article > h1 > span');
	var faqs = $$('ol.faqs');
	for (var s=0; s<faqs.length; s++) {
		if (faqs[s].id==section) {
			lnks[s].className = "title";
			faqs[s].style.display = "block";
		} else {
			lnks[s].className = "";
			faqs[s].style.display = "none";
		}
	}
	void(0);
};

function toggleFAQs(section, num) {
	var list = "ol[id='"+section+"'] > li";
	var faqs = $$(list);
	for (var f=0; f<faqs.length; f++) {
		var a = faqs[f].getElementsByTagName('div')[0];
		a.style.display = (f==(num-1)) ? "block" : "none";
	}
	void(0);
};

// check and uncheck all checkboxes of named as 'name[]'
function checkAll(checkboxAll,checkboxName) {
	if (isIE6) {
		checkboxAll.defaultChecked = checkboxAll.defaultChecked ? false : true;
		checkboxAll.checked = checkboxAll.defaultChecked;
	}
	$A(document.getElementsByName(checkboxName)).each(function(c) {
		c.checked = c.defaultChecked = checkboxAll.checked;
	});
};
// loxeyer: process checked results
// edited by Ewa Wei
function setAction(action){ 
	var Checked = 0;
	for (var i=0; i<thisForm.elements.length; i++) {
		if (thisForm.elements[i].checked) { Checked++; }
	} 

	if (Checked<=0){
		alert("至少选中一条记录");
		return false;
	 }

	switch (action) {
		case "applyJobs": 
			thisForm.action ="/jobs/status1";
			thisForm.submit();
		break; 
		case "deleteTrains": 
			thisForm.action ="/train_infos/deletej";
			thisForm.submit();
		break;
		case "stopJobs": 
			thisForm.action ="/jobs/status0";
			thisForm.submit();
		break;
		case "applyTrains": 
			thisForm.action ="/train_infos/status";
			thisForm.submit();
		break; 
		case "stopTrains": 
			thisForm.action ="/train_infos/status";
			thisForm.submit();
		break;
		case "blockBiz": 
			thisForm.submit();
		break; 
		case "confirmInterviewMyday":
		    thisForm.action ="/interviews/confirmed";
			thisForm.submit();
		break; 	
		case "psn_favs": 
			thisForm.action ="/psn_favs/add";
			thisForm.submit();
		break; 
		case "matches": 
			thisForm.action ="/matches/add";
			thisForm.submit();
		break; 
		case "deleteJobs": 
			thisForm.action ="/jobs/deletej";
			thisForm.submit();
		break; 
	
		case "deleteTempaltes": 
			thisForm.action ="/job_temps/deletej";
			thisForm.submit();
		break; 
		case "deleteIvtemp": 
			thisForm.action ="/iv_temps/deletej";
			thisForm.submit();
		break; 
		case "deleteInterviews": 
			thisForm.action ="/interviews/deletej";
			thisForm.submit();
		break; 
		case "deleteInterviewMyday": 
			thisForm.action ="/interviews/deletei";
			thisForm.submit();
		break; 
		case "deleteMatche": 
			thisForm.action ="/matches/deletej";
			thisForm.submit();
		break; 
		case "deleteMatcheJob": 
			thisForm.action ="/matches/delete";
			thisForm.submit();
		break; 
		case "deletePsnfav": 
			thisForm.action ="/psn_favs/deletej";
			thisForm.submit();
		break; 
		case "deleteResumeblack": 
			thisForm.action ="/resume_blacks/deletej";
			thisForm.submit();
		break; 
		case "deleteResume": 
			thisForm.action ="/matches/deletea";
			thisForm.submit();
		break; 
		case "previewjobs": 
			thisForm.action ="/matches/add";
			thisForm.submit();	
		break; 	
		case "deleteFiles": 
			thisForm.action ="/user_files/deletej";
			thisForm.submit();	
		break;
	}
}
// edited by Ewa Wei
function setDownLoad(action,page){ 

	var Checked = 0;
	for (var i=0; i<thisForm.elements.length; i++) {
		if (thisForm.elements[i].checked) { Checked++; }
	} 

	if (Checked<=0){
		alert("至少选中一条记录");
		return false;
	 }

	switch (action) {
		case "downLoad": 
			thisForm.action ="/user_files/downLoad";
			thisForm.submit();
		break; 
		
	}
}

var abuseHTML, abuseForm;
function showAbuseReport(table,id) {
	abuseHTML = $('abuse');
	if (abuseHTML.innerHTML=="") {
		new Ajax.Request('/'+lang+'/xml/u_abuse.xml', {
			method: 'get',
			onCreate: function() {
				loading.show();
			},
			onSuccess: function(xmlHttpRequest) {
				loading.hide();
				var html=xmlHttpRequest.responseXML.getElementsByTagName("root").item(0).childNodes[0].nodeValue
				abuseHTML.innerHTML=html.replace(/skins\/skin/g, 'skins/'+skin);
				abuseHTML.style.height=$('body').getHeight()+"px";
				repositionForm(abuseHTML);

				abuseForm = document.forms['abuseForm'];
				fillAbuseForm(table,id);
			}
		});
	} else {
		repositionForm(abuseHTML);
		abuseForm.reset();
		fillAbuseForm(table,id);
	}
};

function repositionForm(obj) {
	var formPopup = obj.getElementsByClassName('popup')[0];
	var windowHeight = (document.documentElement.clientHeight) ? (document.documentElement.clientHeight) : document.body.clientHeight;
	var scrollHeight = document.viewport.getScrollOffsets().top;
	formPopup.style.top = scrollHeight+(windowHeight)/2+"px";
	obj.show();
};

function fillAbuseForm(table,id) {
	abuseForm.elements['data[Abuses][table_id]'].value=table;
	abuseForm.elements['data[Abuses][row_id]'].value=id;
};
//]]> 