function PopUpPageWithDifferentName(PageURL,PageName,ScreenWidth,ScreenHeight){
if(ScreenWidth==null){
ScreenWidth=560}
if(ScreenHeight==null){
ScreenHeight=350}
widths=ScreenWidth
heights=ScreenHeight
lefts=(screen.width-widths)/2
tops=(screen.height-heights)/2
thepage=PageURL
thepagename=PageName
newpage=window.open(thepage,thepagename,'scrollbars=yes,resizable=yes,Left='+lefts+',width='+widths+',height='+heights+',top='+tops+'')
newpage.focus()}
function PopUpPageWithDifferentNameNotResizable(PageURL,PageName,ScreenWidth,ScreenHeight){
if(ScreenWidth==null){
ScreenWidth=560}
if(ScreenHeight==null){
ScreenHeight=350}
widths=ScreenWidth
heights=ScreenHeight
lefts=(screen.width-widths)/2
tops=(screen.height-heights)/2
thepage=PageURL
thepagename=PageName
newpage=window.open(thepage,thepagename,'menubar=no,scrollbars=no,resizable=no,Left='+lefts+',width='+widths+',height='+heights+',top='+tops+'')
newpage.focus()}
function showConfirmAndStoreValueOpenUrl(controlIdToStoreValue,valueToStoreInControl,message,url,pageName,screenWidth,screenHeight,loadSomeCodeBehindControlId){
var controlForStoringValue
controlForStoringValue=document.getElementById(controlIdToStoreValue)
var confirmBoxAnswer
confirmBoxAnswer=confirm(message)
var someControlId
someControlId=document.getElementById(loadSomeCodeBehindControlId)
if(confirmBoxAnswer==true){
controlForStoringValue.value=''
controlForStoringValue.value='yes'+valueToStoreInControl
if(url!='nourl'){
PopUpPageWithDifferentName(url,pageName,screenWidth,screenHeight)}
else if(url=='nourl'){
if(loadSomeCodeBehindControlId !=null){
someControlId.click()}}}
else{
controlForStoringValue.value=''
controlForStoringValue.value='no'+valueToStoreInControl
someControlId.click()}}
function setFocus(controlId){
var controlToFocus
controlToFocus=document.getElementById(controlId)
controlToFocus.focus()}
function highlightText(controlId){
var controlToFocus
controlToFocus=document.getElementById(controlId)
if(controlToFocus!=null)
controlToFocus.select()}
function showConfirm(controlId,hiddenFieldId,messageToDisplay){
var control
control=document.getElementById(controlId)
var confirmAnswer
confirmAnswer=confirm(messageToDisplay)
if(confirmAnswer==true){
document.getElementById(hiddenFieldId).value="true"
control.click()}
else{
document.getElementById(hiddenFieldId).value="false"}}
function showConfirmOnKeyPress(controlId,hiddenFieldId,messageToDisplay){
if(event.keyCode==13){
var control
control=document.getElementById(controlId)
var confirmAnswer
confirmAnswer=confirm(messageToDisplay)
if(confirmAnswer==true){
document.getElementById(hiddenFieldId).value="true"
control.click()}
else{
document.getElementById(hiddenFieldId).value="false"}}
else{
document.getElementById(hiddenFieldId).value="false"}}
function showHideControlsOnDemand(flagControlId,showHideControlId,checkReverse){
var parentControl
var showHideControl
parentControl=document.getElementById(flagControlId)
showHideControl=document.getElementById(showHideControlId)
if(checkReverse=false){
if(parentControl.checked==true){
showHideControl.style.visibility='visible'}
else{
showHideControl.style.visibility='hidden'}}
else{
if(parentControl.checked==true){
showHideControl.style.visibility='hidden'}
else{
showHideControl.style.visibility='visible'}}}
function CheckNumericWithDecimal(){
if(window.event.keyCode==46){
window.event.keyCode=46}
else if(!(window.event.keyCode>=48&&window.event.keyCode<=57)){
window.event.keyCode=0}}
function CheckNumeric(){
if
(!(window.event.keyCode>=48&&window.event.keyCode<=57)){
window.event.keyCode=0}}
function CheckNumericWithOneDecimal(controlId){
var controlToCheck=document.getElementById(controlId)
var checkOK="0123456789."
var checkStr=controlToCheck.value
var allValid=true
var allNum=""
var intNumberOfDecimalPoints
intNumberOfDecimalPoints=0
for(i=0;i<checkStr.length;i++){
ch=checkStr.charAt(i)
for(j=0;j<checkOK.length;j++)
if(ch==checkOK.charAt(j))
break
if(j==checkOK.length){
allValid=false
break}
if(ch !=",")
allNum+=ch
if(ch=="."){
if(intNumberOfDecimalPoints==0){
intNumberOfDecimalPoints+=1}
else{
allValid=false
break}}}
if(!allValid){
alert("Please enter numeric values only.")
intNumberOfDecimalPoints=0
controlToCheck.value=''
controlToCheck.focus()
return(false)}}
function fixDecimals(numberValue,numberOfPrecisions){
var numberWithPrecision
numberWithPrecision=(parseFloat(numberValue)).toFixed(numberOfPrecisions)
if(isNaN(numberWithPrecision)==true){
numberWithPrecision=0}
return numberWithPrecision}
function setFixDecimals(controlIdToSet,numberValue,numberOfPrecisions){
var controlToSetValue
controlToSetValue=document.getElementById(controlIdToSet)
controlToSetValue.value=fixDecimals(numberValue,numberOfPrecisions)}
function checkEmptyFields(controlId,message,buttonControl){
var controlToFind
controlToFind=document.getElementById(controlId)
var button
button=document.getElementById(buttonControl)
if(controlToFind.value.length==0){
alert(message)}
else{
button.click()}}
function checkEmptyListItems(controlId,message,buttonControl,invalidIndexToCheck,hiddenFieldId,confirmMessage){
var controlToFind
controlToFind=document.getElementById(controlId)
var button
button=document.getElementById(buttonControl)
if(controlToFind.options[invalidIndexToCheck].selected==true){
alert(message)}
else{
if(confirmMessage !=''&&confirmMessage !=''){
showConfirm(buttonControl,hiddenFieldId,confirmMessage)}
else{
button.click()}}}
function MoveOption(fromControlId,toControlId){
var objSourceElement
var objTargetElement
objSourceElement=document.getElementById(fromControlId)
objTargetElement=document.getElementById(toControlId)
var aryTempSourceOptions=new Array()
var x=0
for(var i=0;i<objSourceElement.length;i++){
if(objSourceElement.options[i].selected){
var intTargetLen=objTargetElement.length++
objTargetElement.options[intTargetLen].text=objSourceElement.options[i].text
objTargetElement.options[intTargetLen].value=objSourceElement.options[i].value}
else{
var objTempValues=new Object()
objTempValues.text=objSourceElement.options[i].text
objTempValues.value=objSourceElement.options[i].value
aryTempSourceOptions[x]=objTempValues
x++}}
objSourceElement.length=aryTempSourceOptions.length
for(var i=0;i<aryTempSourceOptions.length;i++){
objSourceElement.options[i].text=aryTempSourceOptions[i].text
objSourceElement.options[i].value=aryTempSourceOptions[i].value
objSourceElement.options[i].selected=false}}
function StoreIds(leftListBoxId,rightListBoxId,hiddenFieldIdLeft,hiddenFieldIdRight){
var leftListId
leftListId=document.getElementById(leftListBoxId)
var rightListId
rightListId=document.getElementById(rightListBoxId)
var hiddenFieldLeft
hiddenFieldLeft=document.getElementById(hiddenFieldIdLeft)
var hiddenFieldRight
hiddenFieldRight=document.getElementById(hiddenFieldIdRight)
hiddenFieldLeft.value=""
hiddenFieldRight.value=""
for(var i=0;i<leftListId.length;i++){
if(hiddenFieldLeft.value==""){
hiddenFieldLeft.value=leftListId.options[i].value}
else{
hiddenFieldLeft.value+=","+leftListId.options[i].value}}
for(var i=0;i<rightListId.length;i++){
if(hiddenFieldRight.value==""){
hiddenFieldRight.value=rightListId.options[i].value}
else{
hiddenFieldRight.value+=","+rightListId.options[i].value}}}
function moveUpWard(listBoxControlId){
var listField
listField=document.getElementById(listBoxControlId)
if(listField.length==-1){
alert("There are no values which can be moved!")
}else{
var selected=listField.selectedIndex
if(selected==-1){
alert("You must select an entry to be moved!")
}else{
if(listField.length==0){
alert("There is only one entry!\nThe one entry will remain in place.")
}else{
if(selected==0){
alert("The first entry in the list cannot be moved up.")
}else{
var moveText1=listField[selected-1].text
var moveText2=listField[selected].text
var moveValue1=listField[selected-1].value
var moveValue2=listField[selected].value
listField[selected].text=moveText1
listField[selected].value=moveValue1
listField[selected-1].text=moveText2
listField[selected-1].value=moveValue2
listField.selectedIndex=selected-1}}}}}
function moveDownWard(listBoxControlId){
var listField
listField=document.getElementById(listBoxControlId)
if(listField.length==-1){
alert("There are no values which can be moved!")
}else{
var selected=listField.selectedIndex
if(selected==-1){
alert("You must select an entry to be moved!")
}else{
if(listField.length==0){
alert("There is only one entry!\nThe one entry will remain in place.")
}else{
if(selected==listField.length-1){
alert("The last entry in the list cannot be moved down.")
}else{
var moveText1=listField[selected+1].text
var moveText2=listField[selected].text
var moveValue1=listField[selected+1].value
var moveValue2=listField[selected].value
listField[selected].text=moveText1
listField[selected].value=moveValue1
listField[selected+1].text=moveText2
listField[selected+1].value=moveValue2
listField.selectedIndex=selected+1}}}}}
function StoreManulDisplayOrderIds(listBoxControlId,hiddenFieldControlId){
var listBoxId
listBoxId=document.getElementById(listBoxControlId)
var hiddenFieldId
hiddenFieldId=document.getElementById(hiddenFieldControlId)
hiddenFieldId.value=""
for(var i=0;i<listBoxId.length;i++){
if(hiddenFieldId.value==""){
hiddenFieldId.value=listBoxId.options[i].value}
else{
hiddenFieldId.value+=","+listBoxId.options[i].value}}}
var strPreviousControlId
strPreviousControlId=''
function selectOne(radioOrCheckBoxId,gridName,markCheckedSelected,radioOrCheckBox){
var controlId
controlId=document.getElementById(radioOrCheckBoxId)
var controlInitialState
controlInitialState=controlId.checked
all=document.getElementsByTagName("input")
for(i=0;i<all.length;i++){
if(radioOrCheckBox==1){
if(all[i].type=="radio"){
var count=all[i].id.indexOf(gridName+'_ctl')
if(count!=-1){
all[i].checked=false}}}
else if(radioOrCheckBox==2){
if(all[i].type=="checkbox"){
var count=all[i].id.indexOf(gridName+'_ctl')
if(count!=-1){
all[i].checked=false}}}}
if(markCheckedSelected==true){
controlId.checked=true}
else{
if(strPreviousControlId==controlId.id){
if(controlInitialState==true){
controlId.checked=true
strPreviousControlId=controlId.id}
else{
controlId.checked=false
strPreviousControlId=controlId.id}}
else{
controlId.checked=true
strPreviousControlId=controlId.id}}}
function validatePresentOrNewData(dropdownlistId,textboxId,alertMessage){
var ddlId
var txtId
ddlId=document.getElementById(dropdownlistId)
txtId=document.getElementById(textboxId)
if(ddlId.selectedIndex==0&&trim(txtId.value)==''){
alert(alertMessage)
setFocus(ddlId.id)
return false}
else if(ddlId.selectedIndex !=0&&trim(txtId.value)!=''){
alert(alertMessage)
setFocus(ddlId.id)
return false}
else
{return true;}}
function validatePresentData(dropdownlistId,alertMessage){
var ddlId
ddlId=document.getElementById(dropdownlistId)
if(ddlId.selectedIndex==0){
alert(alertMessage)
setFocus(ddlId.id)
return false}
else
{return true;}}
function trim(stringToTrim){
stringToTrim=stringToTrim.replace(/^\s+|\s+$/g,'')
return stringToTrim}
function setDefaultTextBoxValue(controlId,valueToSet){
var textBoxControl
textBoxControl=document.getElementById(controlId)
if(textBoxControl.value=='')
textBoxControl.value=valueToSet}
function removeDefaultTextBoxValue(controlId,valueToSet){
var textBoxControl
textBoxControl=document.getElementById(controlId)
if(textBoxControl.value==valueToSet)
textBoxControl.value=''}
function checkForm(ClientnameId,Textid,FileUploadLogoImageId,EflyerNameId){
var textBoxClientnameControl
var textBoxTextControl
var fileUploadControl
var textBoxEflyerNameControl
textBoxClientnameControl=document.getElementById(ClientnameId)
textBoxTextControl=document.getElementById(Textid)
fileUploadControl=document.getElementById(FileUploadLogoImageId)
textBoxEflyerNameControl=document.getElementById(EflyerNameId)
if(textBoxClientnameControl.value==""&&textBoxTextControl.value==""){
alert("Please select any one option - Either enter name and upload a logo OR  Enter text for the Eflyer!")
return false}
else if(textBoxClientnameControl.value !=""&&fileUploadControl.value !=""&&textBoxTextControl.value !=""){
alert("Please select any one option - Either enter name and upload a logo OR  Enter text for the Eflyer!")
return false}
else if(textBoxClientnameControl.value !=""&&fileUploadControl.value==""){
alert("Please select any one option - Either enter name and upload a logo OR  Enter text for the Eflyer!")
return false}
else if(fileUploadControl.value !=""&&textBoxClientnameControl.value==""){
alert("Please select any one option - Either enter name and upload a logo OR  Enter text for the Eflyer!")
return false}
else if(textBoxEflyerNameControl.value==""){
alert("Please enter a name for the Eflyer")
return false}
else{
return true}}
function changeProductImage(imageControlId,fullyQulifiedImageName,hiddenFieldId,hiddenFieldValueToSet,hiddenFieldForCurrentImageURL,hdnZoomImgUrl,zoomImgUrl){
var objProductImage
objProductImage=document.getElementById(imageControlId)
objProductImage.src=fullyQulifiedImageName
var objhdnZoomImgUrl=document.getElementById(hdnZoomImgUrl)
var hiddenControlForCurrentImageURL
hiddenControlForCurrentImageURL=document.getElementById(hiddenFieldForCurrentImageURL)
hiddenControlForCurrentImageURL.value=fullyQulifiedImageName
var imageName
imageName=fullyQulifiedImageName.split('/')
var imageId
imageId=imageName[imageName.length-1].split('.')
var hiddenControl
hiddenControl=document.getElementById(hiddenFieldId)
if((fullyQulifiedImageName.indexOf('Variant')!=-1)||(fullyQulifiedImageName.indexOf('variant')!=-1)){
hiddenControl.value=hiddenFieldValueToSet+'&vid='+imageId[0]}
else{
hiddenControl.value=hiddenFieldValueToSet}
objhdnZoomImgUrl.value=zoomImgUrl}
function popUpProductImage(hiddenFieldId){
var hiddenControl
hiddenControl=document.getElementById(hiddenFieldId)
PopUpPageWithDifferentName('ProductZoomImage.aspx'+hiddenControl.value,'ViewProductZoomImage',570,580)}
function showColorPicker(colorPickerParentDirectoryPath,textboxControlId){
var controlId
controlId=document.getElementById(textboxControlId)
if(controlId!=null)
CP.popup(colorPickerParentDirectoryPath+'Scripts/ColorPicker/ColorPicker.html',controlId,1)}
function RefreshParentCloseChild(parentUrl){
window.opener.location.href=parentUrl
self.close()}
function CheckMinimumQuantity(minval,clientId){
var obj=document.getElementById(clientId)
var qnty=obj.value
if(parseInt(qnty)<parseInt(minval)|| qnty==""){
alert("Please enter quantity greater than or equal to the minimum quantity !! ")
obj.focus()
return false}
return true}
function go_etracking(){
var where_to=confirm("This will take you an external site.Please close the window to return to original site.Do you wish to continue??")
if(where_to==true){
window.open("http://wwwapps.ups.com/etracking/tracking.cgi")}
else{}}
function go_eFedEx(){
var where_to=confirm("This will take you an external site.Please close the window to return to original site.Do you wish to continue??")
if(where_to==true){
window.open("http://www.fedex.com/Tracking")}
else{}}
function checkpaymentinformation(paymenttype){
alert(' Purchase Order Number cannot be Empty !!')
return false}
function telnumchk(){
event.keyCode=TelDisallowChar(event.keyCode)}
function TelDisallowChar(keyPressed){
if(keyPressed>=48&&keyPressed<=57 || keyPressed==45){}
else{
alert("Please Enter Numbers only")
keyPressed=0}
return keyPressed}
function CheckIsNumber(obj){
if(isNaN(obj.value)){
obj.value=""
alert("Enter valid Number")
return false}
return true}
function windowprint(productid,x){
window.print()}
function select_deselectAll(chkVal,idVal,idChildVal){
var frm=document.forms[0]
for(i=0;i<frm.length;i++){
var str=frm.elements[i].id
var abc=str.split("_")
if(idVal.indexOf('checkboxPickAll')!=-1){
if(chkVal==true){
if(abc[4]==idChildVal){
frm.elements[i].checked=true}}
else{
if(abc[4]==idChildVal){
frm.elements[i].checked=false}}}
else if(idVal.indexOf('checkPickAll')!=-1){
if(chkVal==true){
if(abc[4]==idChildVal){
frm.elements[i].checked=true}}
else{
if(abc[4]==idChildVal){
frm.elements[i].checked=false}}}}}
function BrowsekeyChk(){
var frm=document.forms[0]
alert("Please click on BROWSE to select the file !!!")
document.frm.fleupdLogoImage.PostedFile.FileName=""}
function keyval1(){
if((event.keyCode==8)||(event.keyCode==46)){
event.returnValue=false}}
function showMouseOverImage(strImgPath,objId,e,tipwidth){
if(strImgPath=="")return
obj=document.getElementById(objId)
objDiv=document.getElementById("id_divMouseOverImg")
objImg=document.getElementById("id_MouseOverImg")
objDiv.style.left=(obj.offsetWidth+10)+getposOffset(obj,"left")+"px"
objDiv.style.top=getposOffset(obj,"top")+"px"
objDiv.style.visibility="visible"
objImg.src=strImgPath
obj.onmouseout=HideMouseOverImage}
function HideMouseOverImage(){
objDiv=document.getElementById("id_divMouseOverImg")
objDiv.style.visibility="hidden"}
function getposOffset(what,offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop
var parentEl=what.offsetParent
while(parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop
parentEl=parentEl.offsetParent}
return totaloffset}
function iecompat(){
return(document.compatMode&&document.compatMode!="BackCompat")? document.documentElement : document.body}
function setOpacity(obj,opacityvalue){
var ie=(document.all)? 1 : 0
var opacityelement=(ie)? "filter" : "MozOpacity"
opacityvalue=(ie)? "alpha(opacity="+opacityvalue+")" : opacityvalue/100
obj.style[opacityelement]=opacityvalue;alert(opacityvalue)}
function LoadPages(URl){
document.location.href=URl}


