
// onload="rotateImage('rImage1054');"


//------------------------------------------------------------------
//	                  Toggle images in product page
//------------------------------------------------------------------

// Toogle hide/show BigImage
	function toggleimage(reqimg){
	
		// hide/show BigImage
		var thisimage = document.getElementById(reqimg).style;
		thisimage.display = (thisimage.display=="block")? "none" : "block";
	}   


//------------------------------------------------------------------
//	                  Toggle images in press page
//------------------------------------------------------------------

	function show_image(reqimg){

	  i=1	
	  do
	  {
	  document.getElementById('InsideMag_'+i).style.display='none';
	  i++;
	  lcount=i
	  }while (document.getElementById('InsideMag_'+i));		// hide/show BigFloorImage


	  document.getElementById(reqimg).style.display='block';
}



//------------------------------------------------------------------
//	                  Scrolls text in about us 
//------------------------------------------------------------------

function mv2(v){
	document.getElementById('stream_div').scrollTop=document.getElementById('stream_div').scrollTop+v;
}
function mv(v){
	tid=setInterval("mv2("+v+")",50);
}
function cl(){
	clearInterval(tid);
}

	
//------------------------------------------------------------------
//	                  Validate Login & Register Information
//------------------------------------------------------------------


function ValidateFormLogin(){


//----------------------------------------------------------------------
		if (document.getElementById('full_name').value == "" ) {
			alert("Please enter your name.");
			document.getElementById('full_name').focus()
			return false;
		}
		
		
//----------------------------------------------------------------------
		if (document.getElementById('user_email').value == "" ) {
			alert("Please Enter your Email Address")
			document.getElementById('user_email').focus()
			return false;
		}

		var numval = new String(document.getElementById('user_email').value);
	 	var regex = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		stringmatch = regex.test(numval);

		if (stringmatch==false ) {
		alert("Email address must be in the format name@domain.com");
		return false;
		}

//----------------------------------------------------------------------
		if (document.getElementById('user_password_r').value == "") {
			alert("Please enter a Password of your choice.");
			document.getElementById('user_password_r').focus()
			return false;
		}
		
//----------------------------------------------------------------------
		if (document.getElementById('company').value == "") {
			alert("Please enter the name of your company.");
			document.getElementById('company').focus()
			return false;
		}

		
//----------------------------------------------------------------------
		if (document.getElementById('phone').value == "" ) {
			alert("Please enter your phone number.");
			document.getElementById('phone').focus()
			return false;
		}

		var numval = new String(document.getElementById('phone').value);
	 	var regex = /^[0-9]{3}-[0-9]{3}-[0-9]{4}$/;
		stringmatch = regex.test(numval);

		if (stringmatch==false ) {
		alert("Phone number must be in the format xxx-xxx-xxxx");
		return false;
		}
		
//----------------------------------------------------------------------
		var numval = new String(document.getElementById('fax').value);
	 	var regex = /^[0-9]{3}-[0-9]{3}-[0-9]{4}$/;
		stringmatch = regex.test(numval);

		if (stringmatch==false && numval != "") {
		alert("Fax number must be in the format xxx-xxx-xxxx");
		return false;
		}

		
//----------------------------------------------------------------------
		if (document.getElementById('custexist').value == "") {
			alert("Please specify if you are one our existing customers.");
			document.getElementById('custexist').focus()
			return false;
		}

//----------------------------------------------------------------------
		if (document.getElementById('whatbrands').value == "") {
			alert("Please specify what brands you are intereted in.");
			document.getElementById('whatbrands').focus()
			return false;
		}

//----------------------------------------------------------------------
		if (document.getElementById('cust_position').value == "") {
			alert("Please specify your position within your company.");
			document.getElementById('cust_position').focus()
			return false;
		}

//----------------------------------------------------------------------
		if (document.getElementById('typeofstore').value == "") {
			alert("Please specify what type of store your company is operating.");
			document.getElementById('typeofstore').focus()
			return false;
		}

//----------------------------------------------------------------------
		if (document.getElementById('howmanyloc').value == "") {
			alert("Please specify how many stores your company is operating.");
			document.getElementById('howmanyloc').focus()
			return false;
		}


		

		if (echeck(emailID.value)==false){
			emailID.focus()
			return false
		}

	 	
		return true; /**/
	 }

	 

	
//------------------------------------------------------------------------------------------------------------------------------------
//	                  Rotate images on the "show shelf" section of product_center.asp - 
//------------------------------------------------------------------------------------------------------------------------------------

	 
	 
var interval = 2700; 
var random_display = 0;
var image_dir = "gallery_depts/brands_rotator_"
var ImageNum = 0;
imageArray = new Array();
imageArray[ImageNum++] = new imageItem(image_dir + "2.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "1.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "3.jpg");


var number_of_image = imageArray.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function randNum(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
ImageNum = randNum(0, number_of_image-1);
}
else {
ImageNum = (ImageNum+1) % number_of_image;
}
var new_image = get_ImageItemLocation(imageArray[ImageNum]);
return(new_image);
}

function getPrevImage() {
ImageNum = (ImageNum-1) % number_of_image;
var new_image = get_ImageItemLocation(imageArray[ImageNum]);
return(new_image);
}

function prevImage(place) {
var new_image = getPrevImage();
document[place].src = new_image;
}

function rotateImage(place) {
	var new_image = getNextImage();
	document[place].src = new_image;
	var recur_call = "rotateImage('"+place+"')";
	timerID = setTimeout(recur_call, interval);
}



//------------------------------------------------------------------------------------------------------------------------------------
//	                  Rotate images on the "show shelf" section of product_center.asp
//------------------------------------------------------------------------------------------------------------------------------------


var SlideShowSpeed = 2000;

var CrossFadeDuration = 3;

var Picture = new Array(); 
var Caption = new Array(); 

Picture[1]  = 'gallery_depts/brands_rotator_1.jpg';
Picture[2]  = 'gallery_depts/brands_rotator_2.jpg';
Picture[3]  = 'gallery_depts/brands_rotator_3.jpg';

var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;

var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}

function runSlideShow(){
	if (document.all){
		document.images.rImage1054.style.filter="blendTrans(duration=2)";
		document.images.rImage1054.style.filter="blendTrans(duration=CrossFadeDuration)";
		document.images.rImage1054.filters.blendTrans.Apply();
	}
	document.images.rImage1054.src = preLoad[jss].src;
	if (document.all) document.images.rImage1054.filters.blendTrans.Play();
	
	jss = jss + 1;
	if (jss > (pss)) jss=1;
	

	
	tss = setTimeout('runSlideShow()', SlideShowSpeed);
}
