function checkemail(frm){
	var str=frm.email.value;
//	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	atpos = str.indexOf("@"); //5
	stoppos = str.lastIndexOf("."); //6

	
	if (stoppos > 0 && atpos > 0 && stoppos > atpos && stoppos - atpos > 1)
		ck=true
	else{
		alert("Please input a valid email address!")
		ck=false
	}
	return ck;
}


function check_registration(frm){
	var fsub = true, err, ctr=0, fld_focus;
	var err = "The ff fields must not be empty/invalid: \n\n";
	
	if(frm.login_username.value.length < 4){
		if(fsub == true) fld_focus = frm.login_username;
		fsub = false;
		err += ++ctr+". Username must be atleast 4 characaters long \n";
	}	
	if(frm.login_password.value != frm.conf_login_password.value){
		if(fsub == true) fld_focus = frm.conf_login_password;
		fsub = false;
		err += ++ctr+". Passwords not matched \n";
	}
	if(frm.login_name.value.length < 1){
		if(fsub == true) fld_focus = frm.login_name;
		fsub = false;
		err += ++ctr+". Firstname \n";
	}	
	if(frm.login_fname.value.length < 1){
		if(fsub == true) fld_focus = frm.login_fname;
		fsub = false;
		err += ++ctr+". Lastname \n";
	}	
	if(frm.login_contact.value.length < 1){
		if(fsub == true) fld_focus = frm.login_contact;
		fsub = false;
		err += ++ctr+". Contact Number \n";
	}	
	if(frm.login_email.value.length < 1 || frm.login_email.value.indexOf('@') == -1){
		if(fsub == true) fld_focus = frm.login_email;
		fsub = false;
		err += ++ctr+". Email \n";
	}
	
	if(frm.login_address.value.length < 1){
		if(fsub == true) fld_focus = frm.login_address;
		fsub = false;
		err += ++ctr+". Street Address \n";
	}	
	if(frm.login_city.value.length < 1){
		if(fsub == true) fld_focus = frm.login_city;
		fsub = false;
		err += ++ctr+". City \n";
	}	
	if(frm.login_country.value.length < 1){
		if(fsub == true) fld_focus = frm.login_country;
		fsub = false;
		err += ++ctr+". Country \n";
	}	
	if(frm.login_zip.value.length < 1){
		if(fsub == true) fld_focus = frm.login_zip;
		fsub = false;
		err += ++ctr+". Zip Code \n";
	}	

	
	if(fsub == false){
		alert(err);
		fld_focus.focus();
	}
	return(fsub);
}

function check_join_campaign(frm){
	var fsub = true, err, ctr=0, fld_focus;
	var err = "The ff fields must not be empty/invalid: \n\n";

	if(frm.join_campaign_email.value.length < 1 || frm.join_campaign_email.value.indexOf('@') == -1){
		if(fsub == true) fld_focus = frm.join_campaign_email;
		fsub = false;
		err += ++ctr+". Email \n";
	}
	if(frm.join_campaign_zip.value.length < 1 || frm.join_campaign_zip.value == 'zip'){
		if(fsub == true) fld_focus = frm.join_campaign_zip;
		fsub = false;
		err += ++ctr+". Zip \n";
	}
	
	if(fsub == false){
		alert(err);
		fld_focus.focus();
	}
	return(fsub);
}

function check_post_comment(frm){
	var fsub = true, err, ctr=0, fld_focus;
	var err = "The ff fields must not be empty/invalid: \n\n";

	if(frm.comment_name.value.length < 1){
		if(fsub == true) fld_focus = frm.comment_name;
		fsub = false;
		err += ++ctr+". Name \n";
	}
	if(frm.comment_email.value.length < 1 || frm.comment_email.value.indexOf('@') == -1){
		if(fsub == true) fld_focus = frm.comment_email;
		fsub = false;
		err += ++ctr+". Email \n";
	}
	if(frm.comment_comment.value.length < 1){
		if(fsub == true) fld_focus = frm.comment_comment;
		fsub = false;
		err += ++ctr+". Comment \n";
	}
	
	if(fsub == false){
		alert(err);
		fld_focus.focus();
	}
	return(fsub);
}
//	alert('test');
//function check_employment(frm){
//	alert('test');
//}



function textAreaLimit(limitField, limitCount, limitNum) 
{
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} 
	else {
		limitCount.value = limitNum - limitField.value.length;
	}
//	alert(limitField.value.length+' > '+limitNum);
}

function check_not_empty(elem, frm){
	if(elem.value.length < 1){
		alert('You can\'t send empty content!');
		return false;
	}
	else if(elem.value.length < 3){
		alert('Your content is too short!');
		return false;
	}
	else{
		return true;
	}
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

//	document.getElementById(id).style.display = '';
	
    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
	
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	//alert(opacity);
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
	
	if(opacity == 0) document.getElementById(id).style.display = 'none';
	if(opacity > 0) document.getElementById(id).style.display = '';
}

function check_emailform(frm){

	var fsub = true, err, ctr=0, fld_focus;
	var err = "The ff are either empty or invalid: \n\n";
	
	if(frm.email_name_owner.value.length < 1){
		if(fsub == true) fld_focus = frm.email_name_owner;
		fsub = false;
		err += ++ctr+". Your Name \n";
	}
	if(frm.email_owner.value.length < 1){
		if(fsub == true) fld_focus = frm.email_owner;
		fsub = false;
		err += ++ctr+". Your Email \n";
	}
	if(frm.email_name.value.length < 1){
		if(fsub == true) fld_focus = frm.email_name;
		fsub = false;
		err += ++ctr+". Friend's Name \n";
	}
	if(frm.email_email.value.length < 1 || frm.email_email.value.indexOf('@') == -1 || frm.email_email.value.indexOf('.') == -1){
		if(fsub == true) fld_focus = frm.email_email;
		fsub = false;
		err += ++ctr+". Friend's Email \n";
	}
	if(frm.email_comment.value.length < 1){
		if(fsub == true) fld_focus = frm.email_comment;
		fsub = false;
		err += ++ctr+". Message \n";
	}

	if(fsub == false){
		alert(err);
		fld_focus.focus();
	}
	return(fsub);

}

var mousex, mousey;

<!--

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  mousex = tempX
  mousey = tempY
  //return true
}

//-->

var browser;
get_browser();

function get_browser(){
     if (navigator.appName.indexOf('Microsoft') != -1)
          browser = 'IE';
     else if (navigator.appName.indexOf('Netscape') != -1)
          browser = 'Netscape';
     else browser = 'IE';
	 
//	 alert(browser);
}

var winwidth, winheight;

winSize();

function winSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  winwidth = myWidth;
  winheight = myHeight;
  
//  alert(winwidth);
}

function preloadmouse(){
	document.onmousemove = getMouseXY;
}

var pop_up_repeater, pop_up_repeater_none;
function show_pop_up(id, type){
	
	//
	var temp = winwidth / 2.5;
	
	var whichbox = winwidth < (mousex+temp) ? 'left' : 'right';
	
	//alert(" mousex: "+mousex+', winwidth:'+winwidth+', temp:'+temp);
	
	
	if(type == 'none'){
		//clearTimeout(pop_up_repeater_none);
//		pop_up_repeater_none = setTimeout("show_pop_up2('"+id+"', '"+type+"')",500);
		if(browser == 'IE'){
			pop_up_repeater_none = setTimeout("show_pop_up2('"+id+"', '"+type+"', '"+whichbox+"')",500);
		}else{
			show_pop_up2(id, type, whichbox);
		}
		
	}else{
		
		if(browser == 'IE'){
			pop_up_repeater = setTimeout("show_pop_up2('"+id+"', '"+type+"', '"+whichbox+"')",500);
		}else{
			show_pop_up2(id, type, whichbox);
		}
		
	}
//	
}



function show_pop_up2(id, type, whichbox){
//	this.document.getElementById("span_product_"+id).style.display = type;
	
	
//	alert(mousex+' = '+mousey);
	
//alert(whichbox);
	
	if(type == 'none'){
		this.document.getElementById("span_product_r_"+id).style.display = type;
		this.document.getElementById("span_product_l_"+id).style.display = type;
	}else{
		
		if(whichbox == 'left'){
			this.document.getElementById("span_product_l_"+id).style.display = type;
		}else{
			this.document.getElementById("span_product_r_"+id).style.display = type;

		}
		
		//alert('mousex = '+mousex+' winwidth= '+winwidth);

		
		
		scrollx = document.body.scrollWidth;
		
		if(scrollx-500 < mousex){
			//alert(' Scroll: '+scrollx+' Mouse X: '+mousex);
			//this.document.getElementById("span_product_"+id).style.marginLeft = '-250px';
		}
		
		
		/*var d = "span_product_"+id;
	
		if(d.length < 1) { return; }
		var dd = document.getElementById(d);
		AssignPosition(dd);
		dd.style.display = "block";*/
	
	}
	
}
function image_view(url, width, height){
	img = window.open (url, "mywindow","menubar=1,resizable=1,screenX=100,screenY=100,width="+width+",height="+height);
	img.focus();	
}
function url_view(url, width, height){
	img = window.open (url, "mywindow","menubar=1,resizable=1,screenX=100,screenY=100,width="+width+",height="+height);
	img.focus();	
}





// <!--
var speed = 15; // change scroll speed with this value
/**
 * Initialize the marquee, and start the marquee by calling the marquee function.
 */

 
var go = 0;
var repeater;
/**
 * This is where the scroll action happens.
 * Recursive method until stopped.
 */
function scrollFromLeft(){
	
	
  var el = document.getElementById("marquee_replacement");
  if(el.scrollLeft >= el.scrollWidth-682){
    el.scrollLeft = el.scrollWidth-682;
  };
  el.scrollLeft = el.scrollLeft + speed;
	
//	alert((el.scrollLeft / ((el.scrollWidth-720) - el.scrollLeft)));
	
	if(el.scrollLeft == 0){
		document.getElementById("slider_tick").style.paddingLeft= '0px';
	}
	else{
		totscroll = el.scrollWidth-682;
		leftscroll = el.scrollLeft / totscroll;
		
		document.getElementById("slider_tick").style.paddingLeft= Math.round((280 * leftscroll)) + 'px';
	}
	
	
  repeater = setTimeout("scrollFromLeft()",1);
	
}


function scrollFromRight(){
	clearTimeout(repeater);
	
  var el = document.getElementById("marquee_replacement");
  if(el.scrollLeft >= el.scrollWidth+682){
    el.scrollLeft = 0;
  };
  el.scrollLeft = el.scrollLeft - speed;
	
	
	if(el.scrollLeft == 0){
		document.getElementById("slider_tick").style.paddingLeft= '0px';
	}
	else{
		totscroll = el.scrollWidth-682;
		leftscroll = el.scrollLeft / totscroll;
		
		document.getElementById("slider_tick").style.paddingLeft= Math.round((280 * leftscroll)) + 'px';
	}
	
	
  repeater = setTimeout("scrollFromRight()",1);
	
}
 
/**
 * Set the stop variable to be true (will stop the marquee at the next pass).
 */
function stop(){
  go = 1;
  clearTimeout(repeater);
//  alert('stop');
}
 
/**
 * Set the stop variable to be false and call the marquee function.
 */
/*function startit(){
  go = 0;
  clearTimeout(repeater);
  scrollFromBottom();
}*/

slider_current_value = 0;
slider_value_of_everypage = .003;
var repeater_new_scroll;


function new_drag_scroll(percentage){
	
	
	var el = document.getElementById("new_scroller");
	if(el.scrollLeft >= el.scrollWidth+682){
		el.scrollLeft = 0;
	};
	
	totscroll = el.scrollWidth-682;
	
	slider_current_value = percentage;
	el.scrollLeft = Math.round((totscroll * percentage));
	
	
	//alert(el.scrollLeft);
	
	//
	  
}


function new_next_scrollpage(){
	clearTimeout(repeater_new_scroll);
	
	repeater_new_scroll = setTimeout("new_next_scrollpage()",1);
	
	slider_current_value = slider_current_value + slider_value_of_everypage;
	setSliderValue(slider1, slider_current_value);
//	Control.Slider::options::onChange(.5);

}

function new_prev_scrollpage(){
	clearTimeout(repeater_new_scroll);
	
	repeater_new_scroll = setTimeout("new_prev_scrollpage()",1);
//	Control.Slider::options::onChange(.5);
	slider_current_value = slider_current_value - slider_value_of_everypage;
	setSliderValue(slider1, slider_current_value);
}

function new_scroll_stop(){
  clearTimeout(repeater_new_scroll);
//  alert('stop');
}

function show_menu(id, arg){
	

	if(arg == 'none'){
		//clearTimeout(pop_up_repeater_none);
//		pop_up_repeater_none = setTimeout("show_pop_up2('"+id+"', '"+type+"')",500);
	if(browser == 'IE'){
		menu_repeater_none = setTimeout("show_menu2('"+id+"', '"+arg+"')",500);
	}else{
		show_menu2(id, arg);
	}
		
	}else{
		
	if(browser == 'IE'){
		menu_repeater = setTimeout("show_menu2('"+id+"', '"+arg+"')",500);
	}else{
		show_menu2(id, arg);
	}
		
	}
	

	
}

function show_menu2(id, arg){
	document.getElementById(id).style.display=arg;
}