/*
Displays Confirmation Box (Client Side)
URL1: URL if successful
URL2: URL if not successful
Message1: Confirmation Question
Message2: Message if successful
*/
function ConfirmBox(URL1,URL2,Message1,Message2)
{
	var name=confirm(Message1);
	if (name==true)
	{
		window.location.href=URL1;
		window.navigate;
		alert(Message2);
	}
	else
	{
		window.location.href=URL2;
		window.navigate;
	}
}
function ConfirmBox1(URL1,Message1,Message2)
{
	var name=confirm(Message1);
	if (name==true)
	{
		window.location.href=URL1;
		window.navigate;
		alert(Message2);
	}
}

/*
Opens Popup Centered
URL: URL of popup window
w: Width of popup window
h: Height of popup window
*/
function PopupCentered(URL, w, h) 
{
	var winW = (screen.width - w) / 2;
	var winH = (screen.height - h) / 2;
	details = 'height='+h+',width='+w+',top='+winH+',left='+winW+',scrollbars=no,resizable=no';
	win = window.open(URL, "chat", details)
}

/*
Opens Popup 
URL: URL of popup window
w: Width of popup window
h: Height of popup window
*/
function PopupClose(URL, w, h) 
{
	var winW = (screen.width - w) / 2;
	var winH = 100;//(screen.height - h) / 2;
	details = 'height='+h+',width='+w+',top='+winH+',left='+winW+',scrollbars=no,resizable=no';
	details += ',toolbar=no,location=no,directories=no,status=no,menubar=no';
	win = window.open(URL, "pop", details);
	setTimeout("win.close()", 4000)
}


/*
Disable Enter Key
This function disables Enter Keys from specific controls
Usage Example:
<asp:TextBox id="TextBox1" onkeydown="return ignore_enter_key(TextBox1)" runat="server" ></asp:TextBox>
*/
function ignore_enter_key() 
{ 
    var iKey; 
    var eAny_Event = window.event; 
    iKey = eAny_Event.keyCode; 

    if (iKey != 13) 
    { 
		return true; 
    } 
    else 
    { 
		return false; 
    } 
} 

/*
Auto Tab to Next Textbox
This function automatically tabs to the next textbox
Usage Example:
<input onKeyUp="return autoTab(this, 3, event);">
*/
var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input, len, e) 
{
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if (input.value.length >= len && !containsElement(filter,keyCode)) 
	{
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
}

function containsElement(arr, ele)
{
	var found = false, index = 0;
	while (!found && index < arr.length)
	{
		if(arr[index] == ele)
			found = true;
		else
			index++;
	}
	return found;
}

function getIndex(input)
{
	var index = -1, i = 0, found = false;
	while (i < input.form.length && index == -1)
	{
		if (input.form[i] == input)
			index = i;
		else 
			i++;
	}
	return index;
}

/*
Netscape Fix to post File Types within Form
*/
function showFile(theForm) 
{
    theForm.file1.focus();
    theForm.file1.blur();
    Test = '' + theForm.file1.value;
    alert(Test);
}
/***
iFrame Scroller
***/
var timer_id;
function scroll_iframe(frm,inc,dir) {
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm]) {
    if (dir == "v") window.frames[frm].scrollBy(0, inc);
    else window.frames[frm].scrollBy(inc, 0);
    timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
  }
}
function stopScroll() 
{ 
	if (timer_id) clearTimeout(timer_id); 
}

//used to minimize/maximize sub menus in Repeaters
function ToggleDisplay(id)
{
	var elem = document.getElementById('d' + id);
	var elem1 = document.getElementById('h' + id);
	if (elem) 
	{
		if (elem.style.display != 'block') 
		{
			elem.style.display = 'block';
			elem.style.visibility = 'visible';
			elem1.innerHTML = elem1.innerHTML.replace('plus','minus');
		} 
		else
		{
			elem.style.display = 'none';
			elem.style.visibility = 'hidden';
			elem1.innerHTML = elem1.innerHTML.replace('minus','plus');
		}
	}
}
/* 
Animated Boxes on Home Page
*/
		var screen = 1;
		function next()
		{
			if (screen == 1)
			{
				showfeatured();
			}
			else if (screen == 2)
			{
				showcontest();
			}
			else if (screen == 3)
			{
				showevents();
			}			
			else if (screen == 4)
			{
				showshopping();
			}
			else if (screen == 5)
			{
				showexclusive();
			}
		}
		function back()
		{
			if (screen == 1)
			{
				showshopping();
			}
			else if (screen == 2)
			{
				showexclusive();
			}
			else if (screen == 3)
			{
				showfeatured();
			}			
			else if (screen == 4)
			{
				showcontest();
			}
			else if (screen == 5)
			{
				showevents();
			}
		}
		function showexclusive()
		{
			document.btnhdr.src = "graphics1/homepage/screens/btn_exclusive.gif";
			document.mainscreen.src = "graphics1/homepage/screens/exclusive.jpg";
			screen = 1;
			setTimeout ("showfeatured()", 5000 ); 
			//alert(screen);
		}
		function showfeatured()
		{
			document.btnhdr.src = "graphics1/homepage/screens/btn_featured.gif";
			document.mainscreen.src = "graphics1/homepage/screens/featured.jpg";
			screen = 2;
			setTimeout ("showcontest()", 5000 ); 
			//alert(screen);
		}
		function showcontest()
		{
			document.btnhdr.src = "graphics1/homepage/screens/btn_contest.gif";
			document.mainscreen.src = "graphics1/homepage/screens/contest.jpg";
			screen = 3;
			setTimeout ("showevents()", 5000 ); 
			//alert(screen);
		}
		function showevents()
		{
			document.btnhdr.src = "graphics1/homepage/screens/btn_events.gif";
			document.mainscreen.src = "graphics1/homepage/screens/movies.jpg";
			screen = 4;
			setTimeout ("showshopping()", 5000 ); 
			//alert(screen);
		}
		function showshopping()
		{
			document.btnhdr.src = "graphics1/homepage/screens/btn_shopping.gif";
			document.mainscreen.src = "graphics1/homepage/screens/shopping.jpg";
			screen = 5;
			setTimeout ("showexclusive()", 5000 ); 
			//alert(screen);
		}
		
		
function popImage(imageURL,imageTitle,pos,AutoClose,CopyRight)
{
	//Safari workaround
	if (navigator.userAgent.toLowerCase().indexOf("safari")!=-1){
	var f="top=0, left=0, width="+screen.width+",height="+screen.height+" ,scrollbars=yes";
	imgWin=window.open(imageURL,'im',f);
	}
	else{
	//Based on browser set correct resize mode
	if (parseInt(navigator.appVersion.charAt(0))>=4){
		if (navigator.appName=="Netscape"){
		var f="width="+screen.width+",height="+screen.height;	
		var rs="var iWidth=window.innerWidth;iHeight=window.innerHeight";
		var adj="0";
		}
		if(document.all){
		var f="status=no,width=150,height=150";	
		var rs = "var iWidth=document.body.clientWidth;iHeight=document.body.clientHeight;";
			if(typeof window.opera != 'undefined'){ 
			var adj="window.outerHeight-24";
			}
			else{
			var adj="32";
			}	 
		} 
}
//
v=pos.substring(0,pos.indexOf("_"));
h=pos.substring(pos.indexOf("_")+1);
f+=",left=0,top=0";
imgWin=window.open('about:blank','',f);
imDoc=imgWin.document;
with (imDoc){
writeln('<html><head><title>Loading...</title>');writeln('<sc'+'ript>');
writeln('var sdstr=\"\";window.onerror=function(){return true;}');
writeln('function resizeWin(){');
//If the image size is bigger then screen resize window to the screen size
writeln('iW=document.images[0].width;iH=document.images[0].height;sW=screen.availWidth;sH=screen.availHeight;');
writeln('if(iW>=sW || iH>=sH){window.resizeTo(sW,sH);window.moveTo(0,0)}else{')
writeln(rs);
writeln('var v=\"'+v+'\";var h=\"'+h+'\";');
writeln('switch (v){case \"top\":vPos=0;break;case \"middle\":vPos=(sH-iH-'+adj+')/2;break;case \"bottom\":vPos=sH-'+adj+'-iH;break;default: vPos=0;}');
writeln('switch (h){case \"left\":hPos=0;break;case \"center\":hPos=(sW-iW)/2;break;case \"right\":hPos=sW-iW;break;default: hPos=0;}');
writeln('iWidth = document.images[0].width - iWidth;iHeight = document.images[0].height - iHeight;');
writeln('window.resizeBy(iWidth, iHeight);');
writeln('window.moveBy(hPos,vPos)}}');
writeln('function doTitle(){document.title="'+unescape(imageTitle)+'";}'+'</sc'+'ript>');
var cT=(!AutoClose)?"":"onBlur=\"sdstr=setTimeout('window.close(this)',1000)\"";
//Prevent closing in IE
var fL=(!AutoClose)?"":"onfocus=\"clearTimeout(sdstr)\"";
if(!CopyRight){var cr1="";var cr2=""}else{var cr1=" galleryimg=\"no\" title=\"Copyright Protected\" onmousedown=\"window.close()\" ";var cr2="oncontextmenu=\"return false\" "}
writeln('</head><body  leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" bgcolor=\"FFFFFF\" onload="resizeWin();doTitle();self.focus()" '+cT+' '+fL+' '+cr2+'>');
writeln('<div '+fL+' align=\"center\" style=\"width:100%;height:100%;overflow:auto\"><img src="'+imageURL+'" '+cr1+'></div></body></html>');
close();
}
}
}
function makeBusiness()
{
	one='alexjul';
	two='y@linecraf';
	three='t.com';
	putogether= one+two+three;
	document.gopaypal.business.value=putogether;
}


