// suppress javascript errors
//function stoperror(){return true;}
//window.onerror=stoperror
function addFavorite(){
if (document.all){
	window.external.AddFavorite('http://www.itjobsrus.com/','www.ITjobsRUs.com')}
else {alert('Hit [Ctrl] + [D] to add this page to Bookmarks.')}
}

function emailPage(){
window.navigate('mailto:?subject=An interesting page on www.ITjobsRUs&body=' 
+ escape('Here is an interesting page i found. ' 
+ String.fromCharCode(13) + '' 
+ String.fromCharCode(13) 
+ 'Url: <' + this.window.location + '>'));

}

function doHourglass()
{
  document.body.style.cursor = 'wait';
}

//stop quotes
document.onkeypress = function noquotes(e) {
if (document.all) {
//IE
Key = window.event.keyCode;
} else {
Key = e.which;
}
if (Key == 39 || Key == 96 || Key == 34) {
alert("No quotation marks please.");
window.event.keyCode =""; 
}
//pressing enter for skill search
if (document.getElementById("sksrchtext")) {
if (document.getElementById("sksrchtext").value != "" && Key == 13) {
searchskills();
window.event.keyCode =""; 
}
}
}
function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function stopquotes() {
/*
var strClip = window.clipboardData.getData("Text");
var newClip = "";
if (strClip.indexOf("'") != -1 || strClip.indexOf('"') != -1) {
//replace quotes with null on paste
newClip = replace(strClip,"'","");
newClip = replace(newClip,'"',"");
window.clipboardData.setData("Text",newClip);
alert("Quotation marks have been removed from the pasted text.");
} 
*/
}
function srightclick(e) {
var msg = "All images copyright © 2006 ITJobsRUs.com";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}

function traprclick() {
if (document.images) {
for(s=0;s<document.images.length;s++) {
document.images[s].onmousedown = srightclick;
document.images[s].onmouseup = srightclick;
}
}
}

window.onbeforeunload = unloadnosave;
//window.onunload = doHourglass;
function unloadnosave() {
//new job posting
//doHourglass();
if (document.getElementById("jpnew")) {
if (document.getElementById("jpnsubmitted").value != "Yes") {
var mess = "New Job Posting not saved. All information will be lost.";
return mess;
}

}
//job seeker skills
if (document.getElementById("jsskillspage")) {
if (document.getElementById("jpskillssaved").value != "Yes" || document.frmMain_skillcount.value != document.frmMain_skillc.value) {
var mess = "Skills not saved. All additional skills will be lost.";
return mess;
}

}
//interview questions
if (document.getElementById("intqchanged")) {
if (document.getElementById("intqchanged").value == "Yes") {
var mess = "Interview questions changed but not saved.";
return mess;
}
}
}

//advertising for homepage only
function checkadv() {
	if (document.getElementById("4advertisinggo")) {
		startScroller1();
		startScroller2();
		startScroller3();
		startScroller4();
	}
}

function checkjsa() {
	//js home - check for job alerts
	if (document.getElementById("jsalertscheck")) {
		var jsacount = parseInt(document.getElementById("jsacount").value);
		var jsaprompted = document.getElementById("jsaprompted").value;
		if (jsacount < 1 && jsaprompted != "1") {
			var retval = confirm("You have not yet setup any job alerts.\r\nWould you like to do so now?");
			if (retval) {window.open("/content/alerts/jsalerts.asp","jsalerts","");}
		}
	}
	//new homepage content
	//if (document.getElementById("winlikecontent")) {WinLIKE.init();}
}
