// Refresh
function reFresh() {
location.reload(true)
}
window.setInterval("reFresh()",300000);


// Initiate iScroll
function loaded() {
myScroll = new iScroll('content');
}
document.addEventListener('DOMContentLoaded', loaded);


//Search Button
function changeImage()
{
document.images["searchbutton"].src= "http://www.fashion.net/images/search_over.png";
return true;
}
function changeImageBack() 
{
 document.images["searchbutton"].src = "http://www.fashion.net/images/search_down.png";
 return true;
}
function handleMDown()
{
	document.images["searchbutton"].src = "http://www.fashion.net/images/search_click.png";
	return true;
}
function handleMUp()
{
	changeImage();
	return true;
}


// Featured
body { padding: 0px; width: auto; height: auto;}
#gallery { position: relative; width:560px; height:354px; margin:0; padding:0; }
#gallery li { display: block; }


function OpenWin(section) {
mainX = (screen.availWidth);
mainY = (screen.availHeight);
newWin = window.open(section, 'see_window', 'left=0, top=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width='+mainX+', height='+mainY);
}


// Disable the automatic changing of the background colors of text input fields-->
if(window.attachEvent)
window.attachEvent("onload",setListeners);

function setListeners(){
inputList = document.getElementsByTagName("INPUT");
for(i=0;i<inputList.length;i++){
inputList[i].attachEvent("onpropertychange",restoreStyles);
inputList[i].style.backgroundColor = "";
}
selectList = document.getElementsByTagName("SELECT");
for(i=0;i<selectList.length;i++){
selectList[i].attachEvent("onpropertychange",restoreStyles);
selectList[i].style.backgroundColor = "";
}
}

function restoreStyles(){
if(event.srcElement.style.backgroundColor != "")
event.srcElement.style.backgroundColor = "";


// Hint Magazine subscription
characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU0123456789";
		
function randString() {
input = "";
for (count = 0; count < 10; count++) {
// gen number between 0 and 61
index = Math.floor (Math.random () * 62)
input += characters.charAt (index);
}
return input;
}
		
function fillField() {
document.regform.screenname.value = randString();
document.regform.password.value = document.regform.confirm.value = randString();
}


// Check for correctly filled in info
function checkData (){

if (document.fashion.email.value.length ==0){
alert("Please enter an email address.")
return false}
if (document.fashion.email.value.length >0){
i=document.fashion.email.value.indexOf("@")
j=document.fashion.email.value.indexOf(".",i)
k=document.fashion.email.value.indexOf(",")
kk=document.fashion.email.value.indexOf(" ")
jj=document.fashion.email.value.lastIndexOf(".")+1
len=document.fashion.email.value.length

if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) &&
(len-jj >=2) && (len-jj<=3)) {
}
else {
alert("Please enter an exact email address.\n" +
document.fashion.email.value + " is invalid.")
return false }
}
}
