<!--hide this script from non-javascript-enabled browsers 

/*

####################################     

# File Name: functions.js

# Created By: Umesh Mundhe

# Created On: November 18 ,2005

# Updated By: Amol Divalkar

# This file contain all the common javascript functions

####################################

*/

	/*

     #############################################################################

     # Function Name: isBlank()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Function to check wether given value is blank or not.    

     # Parameters: string strValue : string. 

     # ON SUCCESS: Returns TRUE if value is blank.     

     # ON FAILURE: Returns FLASE  if value is not blank.     

     #############################################################################

	 */



	 function isBlank(strValue)

	 {

		 for(var i = 0; i < strValue.length; i++)

		 {

			 var c = strValue.charAt(i);

			 if ((c != ' ') && (c != '\n') && (c != '\t')) return false;

		 }

		 return true; 

	 }



	/*

     #############################################################################

     # Function Name: isValidEmail()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Validate an email address.

     # Parameters: string strEmail : Email address

     # ON SUCCESS: Returns TRUE if string is in valid email format.     

     # ON FAILURE: Returns FLASE if string is not in valid email format.

     #############################################################################

	 */

	 function isValidEmail(strEmail) 

	 {

		 // assume an email address cannot start with an @ or white space, but it 

		 // must contain the @ character followed by groups of alphanumerics and '-' 

		 // followed by the dot character '.' 

		 // It must end with 2 or 3 alphanumerics. 

		 // 

		 var alnum="a-zA-Z0-9"; 

		 exp="^[^@\\s]+@(["+alnum+"+\\-]+\\.)+["+alnum+"]["+alnum+"]["+alnum+"]?$"; 

		 emailregexp = new RegExp(exp); 

		 result = strEmail.match(emailregexp); 

		 if (result != null) 

		 {

			 return true; 

		 }

		 else 

		 {

			 return false; 

		 }

	 }



	/*

     #############################################################################

     # Function Name: isValidString()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Checks if field value contains only alphanumeric and '_' charactes. Also checks  that alphabetical chars. and '_' must have to be come first and followed by numbers. It returns false if above conditions will not satisfy otherwise true.

     # Parameters: string strVal : string to be validated

     # ON SUCCESS: Returns TRUE if string is in valid format.  

     # ON FAILURE: Returns FLASE if string is not in valid format.  

     #############################################################################

	 */

	 function isValidString(strVal) 

	 {

		 var regex = /^[_]*[a-zA-Z_]+[a-zA-Z0-9_]+$/; 

		 if(!regex.test(strVal)) 

		 {

			 return false; 

		 }

		 else

		 {

			 return true; 

		 }

	 }





	/*

     #############################################################################

     # Function Name: IsAlphaNumeric()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Checks if field value contains only alphanumeric charecters.

     # Parameters: string strVal : string to be validated

     # ON SUCCESS: Returns TRUE if string is valid.     

     # ON FAILURE: Returns FLASE if string is not valid.     

     #############################################################################

	 */

	 function IsAlphaNumeric(strVal) 

	 {

		 var regex = /^[a-zA-Z]+[0-9]+[a-zA-Z0-9]*$/; 

		 if(!regex.test(strVal)) 

		 {

			 return false; 

		 }

		 return true; 

	 }



	/*

     #############################################################################

     # Function Name: checkFileType ()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: It checks the file types.

     # Parameters: obj fld : object of file inout type 

	 #					   string strTypes : valid file types seperated by " "

     # ON SUCCESS: Returns TRUE if object contain valid file type.

     # ON FAILURE: Returns FLASE if object contain invalid file type.

     #############################################################################

	 */

	 function checkFileType(fld, strTypes) 

	 {

		 var strTypeList="";

		 strArray = strTypes.split(" "); 

		 for (i = 0;i<strArray.length;i++) 

		 {

			 if ( i < strArray.length && i > 0) 

			 {

				 strTypeList += "|";

			 }

                strTypeList += "."+strArray[i];

		 }

		 exp="("+strTypeList+")$"; 

		 var regex = new RegExp(exp);

		 if(!regex.test(fld.value)) 

		 {

			 return false; 

		 }

         return true; 

	 }



	/*

     #############################################################################

     # Function Name: isFileSize()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: It ckecks the size of the image file. You can check either in terms of width and height of image or size of image in bytes.

     # Parameters: obj fld : object of file input type for which we want to check size

	 #					   int size : Max file size allowed

     # ON SUCCESS: Returns TRUE file size is less than or equal to max size allowed.

     # ON FAILURE: Returns FLASE  file size is greater than max size allowed.

     #############################################################################

	 */



	 /* ********** Commented By Jayashree ************************

	 function isFileSize(fld, size) 

	 {

	     alert(fld.value);

		 var img = new Image(); 

		 img.src = fld.value; 

		 //alert(img.fileSize);

		 // var Dimensions = img.width + 'x' + img.height; 

		 // var File Size = img.fileSize; 

		alert(img.fileSize);

		alert(size);

		 if(img.fileSize > size) 

		 {

			 return false; 

		 }

		 else

		 {

		      return true; 

	     }

	 }

	*************************************************************/



	/*

     #############################################################################

     # Function Name: LTrim ()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Remove leading spaces.

     # Parameters: string str : String Value

     # ON SUCCESS: Remove leading spaces and return the string.     

     #############################################################################

	 */

	 function LTrim(str)

	 {

		 if(str==null)

		{

			return str;

		}

		for(var i=0;str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t";i++);

		return str.substring(i,str.length);

	 }



	/*

     #############################################################################

     # Function Name: RTrim ()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Remove trailing spaces.

     # Parameters: string str : String Value

     # ON SUCCESS: Remove trailing spaces and return the string.      

     #############################################################################

	 */



	 function RTrim(str)

	 {

		 if(str==null)

		{

			return str;

		}

		for(var i=str.length-1;str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t";i--);

		return str.substring(0,i+1);

	 }



	/*

     #############################################################################

     # Function Name: Trim ()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Remove leading and trailing spaces.

     # Parameters: string str : String Value

     # ON SUCCESS: Remove leading and trailing spaces and return the string.     

     #############################################################################

	 */



	 function Trim(str)

	 {

		 return LTrim(RTrim(str));

	 }





	/*

     #############################################################################

     # Function Name: stripHTMLTags ()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: A simple routine to strip HTML tags from supplied string It's not very clever but it's quite useful. Everything between each "<" and the subsequent ">" is ignored hence it could get confused with any javascript comparisons or comments that contain comparisons.

     # Parameters: string str : String Value

     # ON SUCCESS: Removes html tags from string and return string.     

     #############################################################################

	 */



	 function stripHTMLTags(str) 

	 {

		 var mystr=""; 

		 var chr=""; 

		 var skip=false; 

		 var skipcancel=false; 

		 for (x=0; x<str.length; x++) 

		 {

			 if (skipcancel==true)

			 {

				 skip=false;

			 } 

			 chr=str.charAt(x); 

			 if (chr=="<")

			 {

				 skip=true;skipcancel=false;

			 } 

			 else if (chr==">" && skip==true)

			 {

				 skipcancel=true;

			 } 

			 if (skip==false) 

			 {

				 mystr=mystr+chr; 

			 }

		 }

		 return mystr; 

	 } 



	/*

     #############################################################################

     # Function Name: isValidTime()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Checks if time is in HH:MM:SS format. The seconds are optional.

     # Parameters: string strTime : Time 

     # ON SUCCESS: Returns TRUE if strTime contains time in HH:MM:SS format.

     # ON FAILURE: Returns FLASE  if strTime does not contains time in HH:MM:SS format.

     #############################################################################

	 */



	 function isValidTime(strTime) 

	 {

		 var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?$/; 

		 var matchArray = strTime.match(timePat); 

		 if (matchArray == null) 

		 {

			 return false; 

		 }



		 hour = matchArray[1]; 

		 minute = matchArray[2]; 

		 second = matchArray[4]; 



		 if (isBlank(second)) 

		 {

			 second = null; 

		 }

		 

		 if (hour < 0  || hour > 23) 

		 {

			 return false; 

		 }



		 if (minute<0 || minute > 59) 

		 {

			 return false; 

		 }

		 

		 if (second != null && (second < 0 || second > 59)) 

		 { 

			 return false; 

		 }

		 return true; 

	 }



	/*

     #############################################################################

     # Function Name: isValidNumber()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Checks if the passed string contain valid number or not. 

     # Parameters: string numval : Number to check 

     # ON SUCCESS: Returns TRUE if value is numeric.     

     # ON FAILURE: Returns FLASE  if value is not numeric.

     #############################################################################

	 */



	 function isValidNumber(numval) 

	 {

		 if (isBlank(numval))

		 {

			 return false;

		 }

		 var myRegExp = new RegExp("^[/+|/-]?[0-9]*[/.]?[0-9]*$"); 

		 return myRegExp.test(numval); 

	 }



	/*

     #############################################################################

     # Function Name: isValidInterval()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Check we ther the passed value is valid interval or not ( i.e. 1 Year, 1 day, 20 days etc).

     # Parameters: string interval : Value

     # ON SUCCESS: Returns TRUE parameter contains valid interval.   

     # ON FAILURE: Returns FLASE  parameter is not a valid interval.

     #############################################################################

	 */



	 function isValidInterval(interval) 

	 {

		 var strIntervals = new Array("yrs","year","years","mos","month","months","day","days","week","weeks","hrs","hour","hours","mins","min","minutes","secs","sec","second","seconds"); 

		 strArray = interval.split(" "); 

		 

		 // need at least two items 

		 if (strArray.length < 2) 

		 {

			 return false;

		 }

		 

		 // check all pairs of values to be valid intervals (e.g 2 hrs 5 mins) 

		 for (i = 0;i<strArray.length-1;i=i+2) 

		 {

			 if (isNaN(strArray[i]))

			 {

				 return false;

			 }

			 found=false; 

			 for (var x = 0;x<strIntervals.length;x++) 

			 {

				 if (strArray[i+1].toUpperCase() == strIntervals[x].toUpperCase()) 

				 {

					 found=true;

				 }

			 }

			 if (!found)

			 {

				 return false;

			 }

		 }

		 return true; 

	 }





	/*

     #############################################################################

     # Function Name: isValidDate()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Checks if date is in MM-DD-YYYY format  format. 

     # Parameters: string d : Date

	 #                    

     # ON SUCCESS: Returns TRUE if value is blank.     

     # ON FAILURE: Returns FLASE  if value is not blank.     

     #############################################################################

	 */



	 function isValidDate(d) 

	 {

		 //var strDatestyle = "US"; //United States date style 

		 var strDatestyle = "EU";  //European date style 

		 var strDate; 

		 var strDateArray; 

		 var strDay; 

		 var strMonth; 

		 var strYear; 

		 var intDay; 

		 var intMonth; 

		 var intYear; 

		 var booFound = false; 

		 var strSeparatorArray = new Array("-"," ","/","."); 

		 var intElementNr; 

		 var err = 0; 

		 var strMonthArray = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); 

		 strDate = d; 

		 if (strDate.length < 1) 

		 {

			 return false; 

		 }

		 

		 if (strDate.toLowerCase()=="today" || strDate.toLowerCase()=="now")

		 {

			 return true;

		 }

		 

		 for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 

		 {

			 if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) 

			 {

				 strDateArray = strDate.split(strSeparatorArray[intElementNr]); 

				 if (strDateArray.length != 3) 

				 {

					 err = 1; 

					 return false; 

				 }

				 else 

				 {

					 strDay = strDateArray[0]; 

					 strMonth = strDateArray[1]; 

					 strYear = strDateArray[2]; 

				 }

				 booFound = true; 

			 }

		 }



		 if (booFound == false) 

		 {

			 if (strDate.length>5) 

			 {

				 strDay = strDate.substr(0, 2); 

				 strMonth = strDate.substr(2, 2); 

				 strYear = strDate.substr(4); 

			 }

			 else 

			 {

				 return false; 

			 }

		 }



		 // verify year part   2 or 4 digits 

		 if (strYear.length != 2 && strYear.length != 4) 

		 {

			 return false;

		 }



		 if (isNaN(strYear))

		 {

			 return false;

		 }

		 

		 // US style (swap month and day) 

		 if (strDatestyle == "US") 

		 {

			 strTemp = strDay; 

			 strDay = strMonth; 

			 strMonth = strTemp; 

		 }



		 // verify 1 or 2 digit integer day 

		 if (strDay.length<1 || strDay.length>2) 

		 {

			 return false;

		 }

		 

		 if (isNaN(strDay))

		 {

			 return false;

		 }

		 

		 // month may be digits of characters, hence following check 

		 intMonth = parseInt(strMonth, 10); 

		 if (isNaN(intMonth)) 

		 {

			 for (i = 0;i<12;i++) 

			 {

				 if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) 

				 {

					 intMonth = i+1; 

					 strMonth = strMonthArray[i]; 

					 i = 12; 

				 }

			 }

			 if (isNaN(intMonth)) 

			 {

				 err = 3; 

				 return false; 

			 }

		 }



		 intDay=parseInt(strDay,10); 

		 intYear = parseInt(strYear, 10); 



		 if (intMonth>12 || intMonth<1) 

		 {

			 err = 5; 

			 return false; 

		 }



		 // day in month check 

		 if (intDay < 1 || intDay > 31)

		 {

			 return false;

		 }

		 

		 if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intDay > 30)) 

		 {

			 return false; 

		 }



		 if (intMonth == 2) 

		 {

			 if (LeapYear(intYear)) 

			 {

				 if (intDay > 29) 

				 {

					 return false;

				 }

			 }

			 else 

			 {

				 if (intDay > 28) 

				 {

					 return false;

				 }

			 }

		 }



		 if (intYear<=99)

		 {

		      intYear=intYear+2000;

	     }

		 return intDay+"/"+intMonth+"/"+intYear; 

	 }



	/*

     #############################################################################

     # Function Name: isValidDateTime()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: check a composite date/time field  assume date is everything up to first space  and time is everything after first space.

     # Parameters: string strDateTime : Date time string in DD-MM-YYYY HH:MM:SS

     # ON SUCCESS: Returns TRUE date time is valid.

     # ON FAILURE: Returns FLASE  date time is invalid.

     #############################################################################

	 */



	 function isValidDateTime(strDateTime) 

	 {

		 var dt = Trim(strDateTime); 

		 var intMatch; 

		 var intDateOnly = false; 

		 if (strDateTime.toLowerCase()=="today" || strDateTime.toLowerCase()=="now")

		 {

			 return true;

		 }

		 

		 intMatch=dt.indexOf(":"); 

		 if (intMatch < 0) 

		 {

			 intDateOnly = true; 

			 intMatch=dt.length; 

		 }

		 else 

		 {

			 intMatch=dt.indexOf(" "); 

		 }

		 

		 if (intMatch < 0) 

		 {

			 return false;

		 }

		 

		 // check date 

		 if (!isValidDate(dt.substr(0,intMatch)))

		 {

			 return false;

		 }

		 

		 // check time 

		 if (!intDateOnly) 

		 {

			 if (!isValidTime(dt.substr(intMatch+1,dt.length-intMatch)))

			 {

				 return false;

			 }

		 }

		 return true; 

	 }



	/*

     #############################################################################

     # Function Name: LeapYear()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: check year wether it is a leap year or not.

     # Parameters: string intYear : Year

     # ON SUCCESS: Returns TRUE given year is leap year.

     # ON FAILURE: Returns FLASE  given year is not a leap year.

     #############################################################################

	 */



	 function LeapYear(intYear) 

	 {

		 if (intYear % 100 == 0) 

		 {

			 if (intYear % 400 == 0) 

			 {

				 return true; 

			 }

		 }

		 else 

		 {

			 if ((intYear % 4) == 0) 

			 { 

				 return true; 

			 }

		 }

		 return false; 

	 }



	/*

     #############################################################################

     # Function Name: isEarlierOrEqual()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: This function will accept start date and end date and will check for date format and it will also check wether end date is earlier than start date.

     # Parameters: string start : Start date 

	 #                    string end  : End date 

     # ON SUCCESS: Returns TRUE If both date are in valid format and start date is earlier than end date.

     # ON FAILURE: Returns FLASE If either of date are not in valid format or end date is before start date.

     #############################################################################

	 */



	 function isEarlierOrEqual(start,end) 

	 {

		 // convert dates to dd/mm/yyyy 

		 var myStart = isValidDate(start,true);

		 var myEnd = isValidDate(end,true); 

		 if (myStart=="" || myEnd=="") 

		 {

			 return false; 

		 }



		 var startparts= myStart.split("/"); 

		 var endparts=myEnd.split("/"); 



		 if (Date.UTC(startparts[2],startparts[1],startparts[0]) <= Date.UTC(endparts[2],endparts[1],endparts[0])) 

		 {

			 return true; 

		 }

		 else 

		 {

			 return false; 

		 }

	 }



	/*

     #############################################################################

     # Function Name: isTimeEarlierOrEqual()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: This function will accept start time and end time and will check for time format and it will also check wether end time is earlier than start time.

     # Parameters: string start : Start time 

	 #                    string end  : End time 

     # ON SUCCESS: Returns TRUE If both time are in valid format and start time is earlier than end time.

     # ON FAILURE: Returns FLASE If either of time are not in valid format or end time is before start time.

     #############################################################################

	 */



	 function isTimeEarlierOrEqual(start,end) 

	 {

		 // convert times to UTC dates 

		 if (start=="" || end=="") 

		 {

			 return false; 

		 }

		 var startparts= start.split(":"); 

		 var endparts=end.split(":"); 

		 if (Date.UTC(2000,1,1,startparts[0],startparts[1]) <= Date.UTC(2000,1,1,endparts[0],endparts[1])) 

		 {

			 return true; 

		 }

		 else 

		 {

			 return false; 

		 }

	 } 



	/*

     #############################################################################

     # Function Name: NewWindow()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: This function will open passed url in new window.

     # Parameters: string url : Url

	 #                    string title : Window Title

	 #                    string w : window width

	 #                    string h : window height 

	 #                    string scroll : boolean value will indicate wether window should contain scroll bars or not (true/false, 'yes'/ 'no')

	 #                    string resize : boolean value will indicate wether window is resizable or not (true/false, 'yes'/ 'no')

     # ON SUCCESS: open url in new window.     

     #############################################################################

	 */



	 function NewWindow(url, title, w, h, scroll, resize) 

	 {

		 

		 if (scroll==true || scroll=='yes') 

		 {

			 scroll='yes'; 

		 }

		 else 

		 {

			 scroll='no'; 

		 }

		 if (resize==true || resize=='yes') 

		 {

			 resize=', resizable'; 

		 }

		 else 

		 {

			 resize=''; 

		 }

		 var winl = (screen.width - w) / 2; 

		 var wint = (screen.height - h) / 2; 

		 winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+resize;

		 win = window.open(url, title, winprops);

	 }





	/*

     #############################################################################

     # Function Name: DisplayStatusMsg()

     # Created By: PHP Team   

     # Created on: 12  Sep 2005

     # Purpose: Display passed string in status bar.

     # Parameters: string msgStr : value

     # ON SUCCESS: Display passed string in status bar. 

     #############################################################################

	 */



	 function DisplayStatusMsg(msgStr)

	 { 

	    status=msgStr; document.MM_returnValue = true; 

	 }

// stop hiding --> 



/*

function to validate the step1 frm

*/



function user_validate(){

	if(document.getElementById("first_name").value==""){

		alert("Please enter your first name");

		document.getElementById("first_name").focus();

		return false;

	}

	if(document.getElementById("last_name").value==""){

		alert("Please enter your last name");

		document.getElementById("last_name").focus();

		return false;

	}

	if(document.getElementById("user_email").value==""){

		alert("Please enter your email id");

		document.getElementById("user_email").focus();

		return false;

	}

	if(isValidEmail(document.getElementById("user_email").value)==false){

		alert("Please enter the valid email id");

		return false;

	}

	if(document.getElementById("user_password").value==""){

		alert("Please enter your password");

		document.getElementById("user_password").focus();

		return false;

	}

	

	if(document.getElementById("user_phone").value==""){

		alert("Please enter your phone number");

		document.getElementById("user_phone").focus();

		return false;

	}

	if(isNaN(document.getElementById("user_phone").value)){

		alert("Phone number should be numeric");

		document.getElementById("user_phone").focus();

		return false;

	}

	if(document.getElementById("user_address").value==""){

		alert("Please enter your address");

		document.getElementById("user_address").focus();

		return false;

	}

}





///////////////////////////////////////////////

function valiadate_products(productId){

	var styleVal = "styleValue_"+productId;

	var colorVal = "colorValue_"+productId;

	var proWidth = "";

	if(document.getElementById(styleVal).value==0){

		alert("please select the style");

		document.getElementById(styleVal).focus();

		return false;

	}

	if(document.getElementById(colorVal).value==0){

		alert("please select the color");

		document.getElementById(colorVal).focus();

		return false;

	}

	if(document.getElementById("product_width["+productId+"]").value==""){

		alert("Please enter the width");

		document.getElementById("product_width["+productId+"]").focus();

		return false;

	}

	if(document.getElementById("product_height["+productId+"]").value==""){

		alert("Please enter the height");

		document.getElementById("product_height["+productId+"]").focus();

		return false;

	}

	calulatePrice(productId);

}





/*

Function to calculate the price request based on the ajax request



function calulatePrice(productId){ 

	var styleVal = document.getElementById("styleValue_"+productId).value ;

	var colorVal = document.getElementById("colorValue_"+productId).value

	var widthVal = document.getElementById("product_width["+productId+"]").value

	var heightVal = document.getElementById("product_height["+productId+"]").value



	var ajaxIndex = ajaxObjects.length;	

	ajaxObjects[ajaxIndex] = new sack();

	var url = "calculatePrice.php?productId="+productId+"&styleVal="+styleVal+"&colorVal="+colorVal+"&widthVal="+widthVal+"&heightVal="+heightVal;

	ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get

	ajaxObjects[ajaxIndex].onCompletion = function() {calulatePriceResponse(ajaxIndex,productId) } ;	// Specify function that will be executed after file has been found

	ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function

}



/



function calulatePriceResponse(ajaxIndex,productId){

	reponseText = ajaxObjects[ajaxIndex].response;

	document.getElementById("priceDetail["+productId+"]").innerHTML = reponseText ;

}



*/

/*

Function to check the basic validation in the add to cart page

*/



function validateProduct(){

	/*if(document.getElementById("productStyle").value==0){

		alert("Please select the Product style");

		document.getElementById("productStyle").focus();

		return false;

	}*/

	if(document.getElementById("productColor").value==0){

		alert("Please select the Product color");

		document.getElementById("productColor").focus();

		return false;

	}

	if(document.getElementById("productWidth").value==0){

		alert("Please enter the Width");

		document.getElementById("productWidth").focus();

		return false;

	}

	if(isNaN(document.getElementById("productWidth").value)){

		alert("Please enter the Width must be numeric");

		document.getElementById("productWidth").focus();

		return false;

	}

	

	if(document.getElementById("productHeight").value==0){

		alert("Please enter the height");

		document.getElementById("productHeight").focus();

		return false;

	}

	if(isNaN(document.getElementById("productHeight").value)){

		alert("Please enter the height must be numeric");

		document.getElementById("productHeight").focus();

		return false;

	}

	

	if(document.getElementById("quantity").value==0){

		alert("Please enter the quantity");

		document.getElementById("quantity").focus();

		return false;

	}

	calculatePrice();

	return true;

}



function calldel(m)

{

	if(!confirm(m))

	{

		return false;

	}

	else

	{

		return true;

	}

}



/*

validate the login page

*/



function validateLogin(){

	if(document.getElementById("login_email").value==""){

		alert("Please enter the email id");

		document.getElementById("login_email").focus();

		return false;

	}

	if(document.getElementById("login_password").value==""){

		alert("Please enter the Password");

		document.getElementById("login_password").focus();

		return false;

	}

}



/*

function to calculate the price details

*/



function calculatePrice(){

	/*if(document.getElementById("productStyle").value==0){

		alert("Please select the Product style");

		document.getElementById("productStyle").focus();

		return false;

	}*/

	if(document.getElementById("productColor").value==0){

		alert("Please select the Product color");

		document.getElementById("productColor").focus();

		return false;

	}

	if(document.getElementById("productWidth").value==0){

		alert("Please enter the Width");

		document.getElementById("productWidth").focus();

		return false;

	}

	if(isNaN(document.getElementById("productWidth").value)){

		alert("Please enter the Width must be numeric");

		document.getElementById("productWidth").focus();

		return false;

	}

	if(document.getElementById("productHeight").value==0){

		alert("Please enter the height");

		document.getElementById("productHeight").focus();

		return false;

	}

	if(isNaN(document.getElementById("productHeight").value)){

		alert("Please enter the height must be numeric");

		document.getElementById("productHeight").focus();

		return false;

	}

	/// Call the Ajax function to calculate teh price details

	document.getElementById("priceInfo").innerHTML = '<img src="image/loading.gif" />' ;

	var productId = document.getElementById("productId").value ;

	var heightVal = document.getElementById("productHeight").value ;

	var widthVal = document.getElementById("productWidth").value ;

	

	var ajaxIndex = ajaxObjects.length;	

	ajaxObjects[ajaxIndex] = new sack();

	var url = "mblind/calculatePrice.php?productId="+productId+"&widthVal="+widthVal+"&heightVal="+heightVal;

	ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get

	ajaxObjects[ajaxIndex].onCompletion = function() {calulatePriceResponse(ajaxIndex,productId) } ;	// Specify function that will be executed after file has been found

	ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function



}





function calulatePriceResponse(ajaxIndex,productId){

	reponseText = ajaxObjects[ajaxIndex].response;

	//document.getElementById("priceDetail["+productId+"]").innerHTML = reponseText ;

	if(reponseText=="0" || reponseText==0){

		alert("Defined size not available");

		document.getElementById("priceInfo").innerHTML ="";

		document.getElementById("addCart").disabled="disabled";

		return false;

	}

	document.getElementById("addCart").disabled="";

	document.getElementById("priceInfo").innerHTML = reponseText ;

}



function installationCheck(form){

	var btn = valButton(form.install);

	if (btn == null){

		alert('Please select the installation option');
		return false;
	
	}
	
	var btn1 = valButton(form.measure);

	if (btn1 == null){

		alert('Please select the measurement option');
		return false;
	
	}	

	location.href='blinds.php?doAction=checkout&install='+btn+'&measure='+btn1;

}



function valButton(btn) {

var cnt = -1;

for (var i=btn.length-1; i > -1; i--) {

   if (btn[i].checked) {cnt = i; i = -1;}

   }

if (cnt > -1) return btn[cnt].value;

else return null;

}



