// frames are teh suck
if (top.location != self.location) top.location = self.location;

// for safari users
if (getNode('squery') && !window.ActiveXObject) {
	getNode('squery').setAttribute('type', 'search');
	getNode('squery').setAttribute('placeholder', 'Search');
	getNode('squery').setAttribute('autosave', 'NINRemixes.com');
	getNode('squery').setAttribute('results', 30);
}
if (getNode('squery2') && !window.ActiveXObject) {
	getNode('squery2').setAttribute('type', 'search');
	getNode('squery2').setAttribute('placeholder', 'Search');
	getNode('squery2').setAttribute('autosave', 'NINRemixes.com');
	getNode('squery2').setAttribute('results', 30);
}

// default search text
if (getNode('squery')) {
	getNode('squery').onblur = fillSearchDefault;
	getNode('squery').onfocus = clearSearchDefault;
}
if (getNode('squery2')) {
	getNode('squery2').onblur = fillSearchDefault;
	getNode('squery2').onfocus = clearSearchDefault;
}
fillSearchDefault();

// site scaling
window.onresize = scaleSite;
var iPhoneAddressBarHack = newNode('div');
iPhoneAddressBarHack.style.width = '1px';
iPhoneAddressBarHack.style.height = '1px';
iPhoneAddressBarHack.style.position = 'absolute';
iPhoneAddressBarHack.style.top = '1px';
iPhoneAddressBarHack.style.left = '1px';
iPhoneAddressBarHack.id = 'iPhoneAddressBarHack';
getNode('body').appendChild(iPhoneAddressBarHack);
scaleSite();

// assign event handlers
if (getNode('tagBox')) {
	getNode('tagBox').onkeypress = tagSong;
	getNode('tagBox').onfocus= function() {
		if (this.value == tagBoxDefaultText) this.value = '';
	}
	getNode('tagBox').onblur = function() {
		if (this.value == '') this.value = tagBoxDefaultText;
	}
}
if (getNode('wantToTag')) {
	getNode('wantToTag').onclick = function() {
		getNode('tagBox').style.display='block';
		getNode('wantToTag').style.display='none';
	}
}
if (getNode('showSubmitForm')) {
	getNode('showSubmitForm').onclick = function() {
		getNode('submitReview').style.display='block';
		getNode('showSubmitForm').style.display='none';
	}
}

// new window links
getNode('nav_visuals').setAttribute('target', 'ninremixes_gallery_window');
if (getNode('moreVisuals')) getNode('moreVisuals').setAttribute('target', 'ninremixes_gallery_window');
if (getNode('shoutCasting')) getNode('shoutCasting').setAttribute('target', 'ninremixes_shoutcast_window');

events.addListener(dom.get('user_profile_changeemail'), 'click', function () {
	fadedPopup(450, 170, dom.get('change_email'), 'Change Email Address');
});
events.addListener(dom.get('user_profile_changepassword'), 'click', function () {
	fadedPopup(450, 165, dom.get('change_password'), 'Change Password');
});
