function isspace(c){if(c===' '){return true;}if(c==='\n'){return true;}return false;}
function trim(s){var i=0;while(isspace(s.charAt(i))){i++;}if(i===s.length){return'';}var j=s.length-1;while(isspace(s.charAt(j))){j--;}return s.substring(i,j+1);}
function isEmpty(s){if(s.length===0){return true;}if(trim(s).length===0){return true;}return false;}
function isValidEmail(s){var v=trim(s);var we_had_monkey=false,relief=true;var we_had_dot=false;var count=0;for(i=0;i<v.length;i++){c=v.charAt(i);count++;if(we_had_monkey===true){if(c==='.'){we_had_dot=true;if(relief===true){relief=false;continue;}else{return false;}}if(relief===false){relief=true;}}else{if(c==='.'){continue;}if(c==='@'){if(count==1){return false;}count=0;we_had_monkey=true;relief=false;continue;}}if((c>='a')&&(c<='z')){continue;}if((c>='A')&&(c<='Z')){continue;}if((c>='0')&&(c<='9')){continue;}if((c==='-')||(c==='_')){continue;}if((c==="'")){continue;}return false;}if(we_had_monkey===false){return false;}else{if(c==='@'){return false;}if(c==='-'){return false;}if(c==='_'){return false;}if(c==="'"){return false;}if((c==='.')||(v.charAt(i-2)=='.')){return false;}if(we_had_dot===false){return false;}}return true;}
function isEmail(s){return isValidEmail(s);}
function isNumber(s){var v=trim(s);var i,c,we_had_dot=false;for(i=0;i<v.length;i++){c=v.charAt(i);if(i===0){if((c==='-')||(c==='+')){continue;}}if((c==='.')&&(we_had_dot===false)){we_had_dot=true;continue;}if((c<'0')||(c>'9')){return false;}}if(v>2000000000||v<-2000000000){return false;}return true;}
function createRequestObject(){var ObjXMLHttp=null;if(window.XMLHttpRequest){ObjXMLHttp=new XMLHttpRequest();}else if(window.ActiveXObject){ObjXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");}return ObjXMLHttp;}
function isInteger(s){var i;for(i=0;i<s.length;i++){var c=s.charAt(i);if(((c<"0")||(c>"9"))){return false;}}return true;}
var searchPid=0;var deletedFixRowId='';var deletedFixRowCnt=0;var resultProduct=[];var fixCountValue=1;var deleteedIdeaRowId='';var deleteedIdeaRowCnt=0;var resultIdea=[];var iid='';var deleteedFixRowId='';var deleteedFixRowCnt=0;var result=[];var addMorefixCount=1;var http_request=false;var addMoreideaCount=1;var commentListId="";var commentType="";var mouseEvent="";var mouseX="";var mouseY="";var deletedFixRowIdComp='';var deletedFixRowCntComp=0;var resultProductComp=[];var more_idea_comp='';var deletedIdeaRowIdComp='';var deletedIdeaRowCntComp=0;var resultProductIdeaComp=[];
Array.prototype.find=function(searchStr){var returnArray=false;for(i=0;i<this.length;i++){if(typeof(searchStr)==='function'){if(searchStr.test(this[i])){if(!returnArray){returnArray=[];}
returnArray.push(i);}}else{if(this[i]===searchStr){if(!returnArray){returnArray=[];}returnArray.push(i);}}}return returnArray;};function isTheSame(string1,string2){string1=new RegExp(string1);return string1.test(string2);}
function checkUserName_response(){if(http.readyState===4){var r=http.responseText;var f=document.sign_up;var split_res=r.split("###");if(parseInt(split_res[0],10)===1){document.getElementById("signupAlert").innerHTML="Please choose different Username, username already exists";f.u_username_header.focus();}else if(parseInt(split_res[0],10)===2){document.getElementById("signupAlert").innerHTML="The code you entered is not valid .";document.getElementById("conf_code").value=split_res[1];document.getElementById("captcha_code_img").src=split_res[2];f.captcha_code.value='';f.captcha_code.focus();}else if(parseInt(split_res[0],10)===4){document.getElementById("signupAlert").innerHTML="Please enter different Email Id, Email Id already exists";f.u_email_header.focus();}else{f.action='login_action.php?action_type=add';f.submit();}}}
function checkUserName(val,email){var url='check_user_name.php?queryString='+val+'&email='+email;http=createRequestObject();http.onreadystatechange=checkUserName_response;http.open("GET",url);http.send(null);}
function signupheader(){var f=document.sign_up;document.getElementById("signupAlert").innerHTML='&nbsp;';f.u_username_header.className='';f.u_password_header.className='';f.conf_u_password_header.className='';f.u_zipcode.className='';f.u_email_header.className='';f.captcha_code.className='';f.u_country_header.className='';if(isEmpty(f.u_username_header.value)){document.getElementById("signupAlert").innerHTML='Please enter Username';f.u_username_header.className='validation-fail';f.u_username_header.focus();return false;}
if(isEmpty(f.u_password_header.value)){document.getElementById("signupAlert").innerHTML='Please enter a Password';f.u_password_header.className='validation-fail';f.u_password_header.focus();return false;}
if(f.u_password_header.value.length<6){document.getElementById("signupAlert").innerHTML='Password length should be greater than 6';f.u_password_header.className='validation-fail';f.u_password_header.focus();return false;}
if(f.u_password_header.value!==f.conf_u_password_header.value){document.getElementById("signupAlert").innerHTML='Please enter correct Confirm Password';f.conf_u_password_header.className='validation-fail';f.conf_u_password_header.focus();return false;}
if(isEmpty(f.u_email_header.value)){document.getElementById("signupAlert").innerHTML='Please enter Email';f.u_email_header.className='validation-fail';f.u_email_header.focus();return false;}
if(!isEmail(f.u_email_header.value)){document.getElementById("signupAlert").innerHTML='Please enter valid Email Id';f.u_email_header.className='validation-fail';f.u_email_header.focus();return false;}
if(parseInt(f.u_country_header.value,10)===0){document.getElementById("signupAlert").innerHTML='Please select Country';f.u_country_header.className='validation-fail';f.u_country_header.focus();return false;}
if(isEmpty(f.u_zipcode.value)&&parseInt(f.u_country_header.value,10)===254){document.getElementById("signupAlert").innerHTML='Please enter Zipcode';f.u_zipcode.className='validation-fail';f.u_zipcode.focus();return false;}
if(isEmpty(f.captcha_code.value)){document.getElementById("signupAlert").innerHTML='Please enter the answer';f.captcha_code.className='validation-fail';f.captcha_code.focus();return false;}
if(eval(parseInt(f.first_var.value,10)+parseInt(f.second_var.value,10))!==parseInt(f.captcha_code.value,10)){document.getElementById("signupAlert").innerHTML='Please enter the correct answer';f.captcha_code.className='validation-fail';var rand_first_var=Math.floor((9-1)*Math.random())+1;f.first_var.value=rand_first_var;document.getElementById("first_num").innerHTML=rand_first_var;var rand_second_var=Math.floor((9-1)*Math.random())+1;f.second_var.value=rand_second_var;document.getElementById("second_num").innerHTML=rand_second_var;f.captcha_code.focus();return false;}checkUserName(f.u_username_header.value,f.u_email_header.value);}
function changeCountry(obj){if(parseInt(obj.value,10)!==254&&parseInt(obj.value,10)!==0){document.getElementById("zipshow").className="starthidden";document.getElementById("ziphide").className="";}else{document.getElementById("zipshow").className="";document.getElementById("ziphide").className="starthidden";}}
function changeCountry1(obj){if(parseInt(obj.value,10)!==254&&parseInt(obj.value,10)!==0){document.getElementById("zipshow1").className="starthidden";document.getElementById("ziphide1").className="";}else{document.getElementById("zipshow1").className="";document.getElementById("ziphide1").className="starthidden";}}
function Show_sign_up1(id){window.scrollTo(0,0);var divID=id;document.getElementById(divID).className='modal';document.getElementById('overlay').style.display='block';}
function signHide(id){var divID=id;document.getElementById(divID).className='modal starthidden';document.getElementById('overlay').style.display='none';}
function loginShow(id){window.scrollTo(0,0);var divID=id;document.getElementById(divID).className='modal';document.getElementById('overlay').style.display='block';}
function loginHide(id){var divID=id;document.getElementById(divID).className='modal starthidden';document.getElementById('overlay').style.display='none';}
function signupInLogin(id,hideid){window.scrollTo(0,0);var divID=id;document.getElementById(hideid).className='modal starthidden';document.getElementById(divID).className='modal';}
function hideDiv(){document.getElementById('searchresults').className='searchresults starthidden';}
function showDiv(){document.getElementById('searchresults').className='searchresults starthiddenshow';}
function check_user_response(){if(http.readyState===4){var r=http.responseText;var f=document.sign_in;if(r==='false'){document.getElementById("loginAlert").innerHTML="The username or password you entered is incorrect.";f.u_username_login.focus();}else{f.action='';f.submit();}}}
function check_user(username,password){var url='check_user_name.php?username='+username+'&password='+password+'&checkUser=yes';http=createRequestObject();http.onreadystatechange=check_user_response;http.open("GET",url);http.send(null);}
function signin(){var f=document.sign_in;document.getElementById("loginAlert").innerHTML='&nbsp;';f.u_password_login.className='';f.u_username_login.className='';if(isEmpty(f.u_username_login.value)){document.getElementById("loginAlert").innerHTML='Please enter Username';f.u_username_login.className='validation-fail';f.u_username_login.focus();return false;}if(isEmpty(f.u_password_login.value)){document.getElementById("loginAlert").innerHTML='Please enter a Password';f.u_password_login.className='validation-fail';f.u_password_login.focus();return false;}check_user(f.u_username_login.value,f.u_password_login.value);}
function loginKeyboard(e){var keyCode=e.keyCode||window.event.keyCode;if(parseInt(keyCode,10)===13){signin();}}
function clear(id){document.getElementById(id).innerHTML="";}var fid='';function savedresponse(){if(http.readyState===4){var r=http.responseText;var me_too_id='me_too_'+fid+'_div';var me_too_val='me_too_'+fid+'_value';document.getElementById(me_too_val).innerHTML=r;document.getElementById(me_too_id).innerHTML='<p><strong>including you!</strong></p>';}}
function me_too_fun(id){var url='savefixcnt_ajax.php?id='+id;fid=id;http=createRequestObject();http.onreadystatechange=savedresponse;http.open("GET",url);http.send(null);}
function add_fix(pid){var f=document.fixlist;f.action=pid;f.submit();}
function fixlists(){var sF=document.searchForm;var fieldName=document.getElementById('inputStringName').value;document.getElementById("inputString").value=document.getElementById(fieldName).value;if(isEmpty(document.getElementById("inputString").value)){return false;}if(document.getElementById("inputString").value==='Enter product name ...'){return false;}if(parseInt(searchPid,10)!==0){if(searchPid==='is_cmp_name'){sF.action="companies/"+document.getElementById("inputString").value.replace(' ',"-");location.href=sF.action;return false;}else if(searchPid==='is_prod_name'){sF.action="products/"+document.getElementById("inputString").value.replace(' ',"-");location.href=sF.action;return false;}else{sF.action=searchPid;location.href=sF.action;return false;}}else{sF.action='search/'+document.getElementById("inputString").value.replace(' ',"-");sF.submit();}}
function fixlists_click(obj){var sF=document.searchForm;var fieldName=document.getElementById('inputStringName').value;document.getElementById("inputString").value=document.getElementById(fieldName).value;if(isEmpty(document.getElementById("inputString").value)){return false;}if(document.getElementById("inputString").value==='Enter product name ...'){return false;}var search_word	= document.getElementById("inputString").value;search_word = ReplaceAll(' ', '-',search_word);search_word = ReplaceAll('&','%26',search_word);obj.href ='search/'+search_word;sF.action ='search/'+search_word;sF.submit();}var m=0;var prevTime=0;var check_timeout='';
function lookup_response(){if(http.readyState===4){var r=http.responseText;if(r.length>0){var value='';if(document.getElementById('inputStringName')){var fieldName=document.getElementById('inputStringName').value;value=document.getElementById(fieldName).value;}if(value){document.getElementById('searchresults').className='searchresults starthiddenshow';document.getElementById('searchresults').innerHTML=r;document.getElementById(document.getElementById('inputStringName').value).className='query fancylabel results';}}else{document.getElementById('searchresults').className='searchresults starthidden';document.getElementById('searchresults').innerHTML='';document.getElementById(document.getElementById('inputStringName').value).className='query fancylabel';}}else{document.getElementById(document.getElementById('inputStringName').value).className='query fancylabel loading';}}
function lookup(val,e){var fieldName;clearTimeout(check_timeout);var keyCode=e.keyCode||window.event.keyCode;if(parseInt(keyCode,10)===40){m++;if(document.getElementById("dropdown_"+m)){document.getElementById("dropdown_"+m).style.background='#FF8A4A';fieldName=document.getElementById('inputStringName').value;searchPid=document.getElementById("dropdown_"+m).name;if(m>1){document.getElementById("dropdown_"+eval(m-1)).style.background='';}}else{m--;}return false;}if(parseInt(keyCode,10)===38){if(m>1){document.getElementById("dropdown_"+eval(m-1)).style.background='#FF8A4A';fieldName=document.getElementById('inputStringName').value;searchPid=document.getElementById("dropdown_"+eval(m-1)).name;document.getElementById("dropdown_"+m).style.background='';m--;}return false;}m=0;if(val&&val.length>1){check_timeout=setTimeout(function(){var url='search_text_ajax.php?queryString='+val;http=createRequestObject();http.onreadystatechange=lookup_response;http.open("GET",url);http.send(null);},1000);}else{document.getElementById('searchresults').className='searchresults starthidden';document.getElementById('searchresults').innerHTML='';document.getElementById(document.getElementById('inputStringName').value).className='query fancylabel';}}
function hideListDiv1(val){document.getElementById(document.getElementById('inputStringName').value).style.color="#888";if(val){if(document.getElementById('cntofanchor')){if(document.getElementById('cntofanchor').value){document.onclick=function onclick(event){document.getElementById('searchresults').className='searchresults starthidden';document.getElementById(document.getElementById('inputStringName').value).className='query fancylabel';};}}}}
function showDiv1(val){document.getElementById(document.getElementById('inputStringName').value).style.color="#000000";if(val){if(document.getElementById('cntofanchor')){if(document.getElementById('cntofanchor').value){document.onclick='';document.getElementById('searchresults').className='searchresults starthiddenshow';document.getElementById(document.getElementById('inputStringName').value).className='query fancylabel results';}}}}
function add_fix_check_user_response(){if(http.readyState===4){var r=http.responseText;var f=document.addFix;if(r==='false'){document.getElementById("loginAlertprob").innerHTML="The username or password you entered is incorrect.";f.login_u_username.className='validation-fail';f.login_u_username.focus();}else{for(var i=1; i <= eval(addMorefixCount); i++){var description = "description"+i;if(document.getElementById("div_prob"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}f.action='login_action.php?action_type=add_fix_login';f.submit();}}}
function add_fix_check_user(username,password){var url='check_user_name.php?username='+username+'&password='+password+'&checkUser=yes';http=createRequestObject();http.onreadystatechange=add_fix_check_user_response;http.open("GET",url);http.send(null);}
function loginToAddFix(pid){var f=document.addFix;document.getElementById("loginAlertprob").innerHTML='&nbsp;';f.login_u_password.className='';f.login_u_username.className='';if(isEmpty(f.login_u_username.value)){document.getElementById("loginAlertprob").innerHTML='Please enter Username';f.login_u_username.className='validation-fail';f.login_u_username.focus();return false;}if(isEmpty(f.login_u_password.value)){document.getElementById("loginAlertprob").innerHTML='Please enter Password';f.login_u_password.className='validation-fail';f.login_u_password.focus();return false;}f.pid.value=pid;f.fixcnt.value=addMorefixCount;f.removedfixcnt.value=deleteedFixRowId;add_fix_check_user(f.login_u_username.value,f.login_u_password.value);}
function checkUserName_add_it_response(){if(http.readyState===4){var r=http.responseText;var f=document.addFix;var split_res=r.split("###");if(parseInt(split_res[0],10)===1){document.getElementById("loginAlertprob").innerHTML="Please choose different Username, username already exists";f.u_username.focus();}else if(parseInt(split_res[0],10)===2){document.getElementById("loginAlertprob").innerHTML="The code you entered is not valid .";document.getElementById("conf_code1").value=split_res[1];document.getElementById("captcha_code_img1").src=split_res[2];f.captcha_code1.value='';f.captcha_code1.focus();}else if(parseInt(split_res[0],10)===4){document.getElementById("loginAlertprob").innerHTML="Please enter different Email Id, Email Id already exists";f.u_email.focus();}else{for(var i=1; i <= eval(addMorefixCount); i++){var description = "description"+i;if(document.getElementById("div_prob"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}f.action='login_action.php?action_type=add_fix_sign_up';f.submit();}}}
function checkUserName_add_it(val,email){var url='check_user_name.php?queryString='+val+'&email='+email;http=createRequestObject();http.onreadystatechange=checkUserName_add_it_response;http.open("GET",url);http.send(null);}
function signup_add_it(pid){var f=document.addFix;document.getElementById("signupAlertprob").innerHTML='&nbsp;';f.u_username.className='';f.u_password.className='';f.conf_u_password.className='';f.u_country.className='';f.u_zipcode1.className='';f.u_email.className='';f.captcha_code1.className='';if(isEmpty(f.u_username.value)){document.getElementById("signupAlertprob").innerHTML='Please enter Username';f.u_username.className='validation-fail';f.u_username.focus();return false;}
if(isEmpty(f.u_password.value)){document.getElementById("signupAlertprob").innerHTML='Please enter a Password';f.u_password.className='validation-fail';f.u_password.focus();return false;}
if(f.u_password.value.length<6){document.getElementById("signupAlertprob").innerHTML='Password length should be greater than 6';f.u_password.className='validation-fail';f.u_password.focus();return false;}
if(f.u_password.value!==f.conf_u_password.value){document.getElementById("signupAlertprob").innerHTML='Please enter correct Confirm Password';f.conf_u_password.className='validation-fail';f.conf_u_password.focus();return false;}
if(isEmpty(f.u_email.value)){document.getElementById("signupAlertprob").innerHTML='Please enter Email';f.u_email.className='validation-fail';f.u_email.focus();return false;}
if(parseInt(f.u_country.value,10)===''||parseInt(f.u_country.value,10)===0){document.getElementById("signupAlertprob").innerHTML='Please select Country';f.u_country.className='validation-fail';f.u_country.focus();return false;}
if(isEmpty(f.u_zipcode1.value)&&parseInt(f.u_country.value,10)===254){document.getElementById("signupAlertprob").innerHTML='Please enter Zipcode';f.u_zipcode1.className='validation-fail';f.u_zipcode1.focus();return false;}
if(isEmpty(f.captcha_code1.value)){document.getElementById("signupAlertprob").innerHTML='Please enter the answer';f.captcha_code1.className='validation-fail';f.captcha_code1.focus();return false;}
if(eval(parseInt(f.first_var_fix.value,10)+parseInt(f.second_var_fix.value,10))!==parseInt(f.captcha_code1.value,10)){document.getElementById("signupAlertprob").innerHTML='Please enter the correct answer';var rand_first_var=Math.floor((9-1)*Math.random())+1;f.first_var_fix.value=rand_first_var;document.getElementById("first_num_fix").innerHTML=rand_first_var;var rand_second_var=Math.floor((9-1)*Math.random())+1;f.second_var_fix.value=rand_second_var;document.getElementById("second_num_fix").innerHTML=rand_second_var;f.captcha_code1.className='validation-fail';f.captcha_code1.focus();return false;}
f.pid.value=pid;f.fixcnt.value=addMorefixCount;f.removedfixcnt.value=deleteedFixRowId;checkUserName_add_it(f.u_username.value,f.u_email.value);}
function checkUserName_add_it_product_response(){if(http.readyState===4){var r=http.responseText;var f=document.addProduct;var split_res=r.split("###");if(parseInt(split_res[0],10)===1){document.getElementById("sign_up_add_it_alert").innerHTML="Please choose different Username, username already exists";f.u_username.focus();}
else if(parseInt(split_res[0],10)===2){document.getElementById("sign_up_add_it_alert").innerHTML="The code you entered is not valid .";document.getElementById("conf_code1").value=split_res[1];document.getElementById("captcha_code_img1").src=split_res[2];f.captcha_code1.value='';f.captcha_code1.focus();}
else if(parseInt(split_res[0],10)===4){document.getElementById("sign_up_add_it_alert").innerHTML="Please enter different Email Id, Email Id already exists";f.u_email.focus();}
else{for(var i=1; i <= eval(fixCountValue); i++){var description = "description"+i;if(document.getElementById("div_prob"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}document.getElementById('want_it_fixed_cnt').value=fixCountValue;f.removedfixIds.value=deletedFixRowId;f.action='login_action.php?action_type=add_product_sign_up';f.submit();}}}
function checkUserName_add_it_product(val,email){var url='check_user_name.php?queryString='+val+'&email='+email;http=createRequestObject();http.onreadystatechange=checkUserName_add_it_product_response;http.open("GET",url);http.send(null);}
function signup_add_it_product(){var f=document.addProduct;document.getElementById("signupAlertprob").innerHTML='&nbsp;';var manuf_fieldName=document.getElementById('manufacturerName').value;var prdouct_fieldName=document.getElementById('productNameId').value;f.u_username.className='';f.u_password.className='';f.conf_u_password.className='';f.u_country.className='';f.u_zipcode1.className='';f.u_email.className='';f.captcha_code1.className='';if(isEmpty(f.u_username.value)){document.getElementById("signupAlertprob").innerHTML='Please enter Username';f.u_username.className='validation-fail';f.u_username.focus();return false;}
if(isEmpty(f.u_password.value)){document.getElementById("signupAlertprob").innerHTML='Please enter a Password';f.u_password.className='validation-fail';f.u_password.focus();return false;}
if(f.u_password.value.length<6){document.getElementById("signupAlertprob").innerHTML='Password length should be greater than 6';f.u_password.className='validation-fail';f.u_password.focus();return false;}
if(f.u_password.value!==f.conf_u_password.value){document.getElementById("signupAlertprob").innerHTML='Please enter correct Confirm Password';f.conf_u_password.className='validation-fail';f.conf_u_password.focus();return false;}
if(isEmpty(f.u_email.value)){document.getElementById("signupAlertprob").innerHTML='Please enter Email';f.u_email.className='validation-fail';f.u_email.focus();return false;}
if(parseInt(f.u_country.value,10)===''||parseInt(f.u_country.value,10)===0){document.getElementById("signupAlertprob").innerHTML='Please select Country';f.u_country.className='validation-fail';f.u_country.focus();return false;}
if(isEmpty(f.u_zipcode1.value)&&parseInt(f.u_country.value,10)===254){document.getElementById("signupAlertprob").innerHTML='Please enter Zipcode';f.u_zipcode1.className='validation-fail';f.u_zipcode1.focus();return false;}
if(isEmpty(f.captcha_code1.value)){document.getElementById("signupAlertprob").innerHTML='Please enter the answer';f.captcha_code1.className='validation-fail';f.captcha_code1.focus();return false;}
if(eval(parseInt(f.first_var_prod.value,10)+parseInt(f.second_var_prod.value,10))!==parseInt(f.captcha_code1.value,10)){document.getElementById("signupAlertprob").innerHTML='Please enter the correct answer';var rand_first_var=Math.floor((9-1)*Math.random())+1;f.first_var_prod.value=rand_first_var;document.getElementById("first_num_fix").innerHTML=rand_first_var;var rand_second_var=Math.floor((9-1)*Math.random())+1;f.second_var_prod.value=rand_second_var;document.getElementById("second_num_fix").innerHTML=rand_second_var;f.captcha_code1.className='validation-fail';f.captcha_code1.focus();return false;}
document.getElementById("manufacturer").value=document.getElementById(manuf_fieldName).value;document.getElementById('productName').value=document.getElementById(prdouct_fieldName).value;checkUserName_add_it_product(f.u_username.value,f.u_email.value);}
function add_product_check_user_response(){if(http.readyState===4){var r=http.responseText;var f=document.addProduct;if(r==='false'){document.getElementById("loginAlertprob").innerHTML="The username or password you entered is incorrect.";f.login_u_username.className='validation-fail';f.login_u_username.focus();}
else{for(i=1;i<=fixCountValue;i++){var title="title"+i;var description="description"+i;}for(var i=1; i <= eval(fixCountValue); i++){var description = "description"+i;if(document.getElementById("div_prob"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}f.action='login_action.php?action_type=add_product_login';f.submit();}}}
function add_product_check_user(username,password){var url='check_user_name.php?username='+username+'&password='+password+'&checkUser=yes';http=createRequestObject();http.onreadystatechange=add_product_check_user_response;http.open("GET",url);http.send(null);}
function loginToAddFix_1(){document.getElementById('want_it_fixed_cnt').value=fixCountValue;var f=document.addProduct;document.getElementById("loginAlertprob").innerHTML='&nbsp;';f.login_u_password.className='';f.login_u_username.className='';if(isEmpty(f.login_u_username.value)){document.getElementById("loginAlertprob").innerHTML='Please enter Username';f.login_u_username.className='validation-fail';f.login_u_username.focus();return false;}
if(isEmpty(f.login_u_password.value)){document.getElementById("loginAlertprob").innerHTML='Please enter Password';f.login_u_password.className='validation-fail';f.login_u_password.focus();return false;}
f.removedfixIds.value=deletedFixRowId;add_product_check_user(f.login_u_username.value,f.login_u_password.value);}
function add_it_product(user){document.getElementById('want_it_fixed_cnt').value=fixCountValue;var f=document.addProduct;document.getElementById('manufacturer_alert').innerHTML="";document.getElementById('product_alert').innerHTML="";var manuf_fieldName=document.getElementById('manufacturerName').value;document.getElementById("manufacturer").value=document.getElementById(manuf_fieldName).value;var prdouct_fieldName=document.getElementById('productNameId').value;document.getElementById(manuf_fieldName).className='fancylabel';document.getElementById(prdouct_fieldName).className='fancylabel';if(isEmpty(document.getElementById(manuf_fieldName).value)||document.getElementById(manuf_fieldName).value==='Eg: Apple, Sony, Canon ...'){document.getElementById(manuf_fieldName).className='fancylabel validation-fail';document.getElementById('manufacturer_alert').innerHTML="Please enter the Product Manufacturer";document.getElementById(manuf_fieldName).focus();scroll(0,90);return false;}
if(isEmpty(document.getElementById(prdouct_fieldName).value)||document.getElementById(prdouct_fieldName).value==='Eg: iPhone, XBR8, 5D Mark 2 ...'){document.getElementById(prdouct_fieldName).className='fancylabel validation-fail';document.getElementById('product_alert').innerHTML="Please enter the Prodcut Name";document.getElementById(prdouct_fieldName).focus();scroll(0,90);return false;}
document.getElementById('productName').value=document.getElementById(prdouct_fieldName).value;for(var i=1;i<=eval(fixCountValue);i++){var title="title"+i;var description="description"+i;if(resultProduct.find(i)&&resultProduct.length>0){}
else{if(document.getElementById("div_prob"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('problem_'+title).innerHTML='';document.getElementById('problem_'+description).innerHTML='';if(document.getElementById(title)){if(isEmpty(document.getElementById(title).value)||(document.getElementById(title).value==="Eg: Won't switch off ...")){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('problem_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}}
if(document.getElementById(description)){if(isEmpty(document.getElementById(description).value)||(document.getElementById(description).value==="Describe the problem in full ...")){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('problem_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}}
if(user==='Y'){for(var i=1; i <= eval(fixCountValue); i++){var description = "description"+i;if(document.getElementById("div_prob"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}f.removedfixIds.value=deletedFixRowId;f.action_type.value='add_product';f.action='user_action.php';f.submit();}
else{window.scrollTo(0,0);document.getElementById("modalidea").className='modal';document.getElementById('overlay').style.display='block';}}
function createFields(fixCount){var newdiv,divid,content,container;newdiv=document.createElement("div");newdiv.setAttribute("name",'div_prob'+fixCount);newdiv.setAttribute("id",'div_prob'+fixCount);newdiv.setAttribute("class",'problem');divid='div_prob'+fixCount;content='<p><label for=title'+fixCount+'>Title <a id=anchor'+fixCount+' href=javascript:removerow('+fixCount+') >Remove</a></label><input name=title'+fixCount+' id=title'+fixCount+' type=text class=fancylabel title=2 size=55 /><span id=problem_title'+fixCount+' class=error-msg></span></p>';content+='<p><label for=description'+fixCount+'>Description</label><textarea name=description'+fixCount+' id=description'+fixCount+' class=fancylabel title=2 rows=5 cols=50></textarea><span id=problem_description'+fixCount+' class=error-msg></span></p>';newdiv.innerHTML=content;container=document.getElementById("addmoredivs");container.appendChild(newdiv);document.getElementById('title'+fixCount).title="Eg: Won't switch off ...";document.getElementById('description'+fixCount).title="Describe the problem in full ...";Global.init();}
function fix_count_fun_incr(){for(var i=1;i<=eval(fixCountValue);i++){var title="title"+i;var description="description"+i;if(resultProduct.find(i)&&resultProduct.length>0){}
else{if(document.getElementById("div_prob"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('problem_'+title).innerHTML='';document.getElementById('problem_'+description).innerHTML='';if(document.getElementById(title)){if(isEmpty(document.getElementById(title).value)||(document.getElementById(title).value==="Eg: Won't switch off ...")){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('problem_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}}
if(document.getElementById(description)){if(isEmpty(document.getElementById(description).value)||(document.getElementById(description).value==="Describe the problem in full ...")){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('problem_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}}fixCountValue=eval(fixCountValue+1);createFields(fixCountValue);}
function removerow(divNum){deletedFixRowCnt++;resultProduct[deletedFixRowCnt]=divNum;if(deletedFixRowId!==''){deletedFixRowId=deletedFixRowId+','+divNum;}else{deletedFixRowId=divNum;}var d1=document.getElementById('addmoredivs');var d2=document.getElementById('div_prob'+divNum);d1.removeChild(d2);var m=1;for(var i=1;i<=eval(fixCountValue);i++){var title="title"+i;var description="description"+i;if(resultProduct.find(i)&&resultProduct.length>0){}else{if(i!==1){m++;}}}}
var globalObj='';var n;var p;function lookup_response_1(){if(http.readyState===4){var r=http.responseText;var suggestions=globalObj.id+'_suggestions';var autoSuggestionsList=globalObj.id+'_autoSuggestionsList';if(r.length>0){if(globalObj.value){document.getElementById(autoSuggestionsList).className='searchresults';document.getElementById(autoSuggestionsList).innerHTML=r;document.getElementById(globalObj.id).className='query fancylabel results';}}
else{document.getElementById(autoSuggestionsList).className='searchresults starthidden';document.getElementById(autoSuggestionsList).innerHTML='';document.getElementById(globalObj.id).className='fancylabel';}}}
function lookup_1(obj,e){var keyCode,newval,url;keyCode=e.keyCode||window.event.keyCode;clearTimeout(check_timeout);if(parseInt(keyCode,10)===13){document.getElementById(obj.id+"_autoSuggestionsList").className='searchresults starthidden';document.getElementById(obj.id).className='fancylabel';return false;}
if(parseInt(keyCode,10)===9&&isTheSame(obj.id.split('_',1),'productName')){document.getElementById(obj.id.replace("manufacturer","productName")+"_autoSuggestionsList").className='searchresults starthidden';document.getElementById(obj.id).className='fancylabel';return false;}
if(parseInt(keyCode,10)===9&&isTheSame(obj.id.split('_',1),'manufacturer')){document.getElementById(obj.id.replace("manufacturer","productName")+"_autoSuggestionsList").className='searchresults starthidden';document.getElementById(obj.id).className='fancylabel';return false;}
if(parseInt(keyCode,10)===40){if(isTheSame(obj.id.split('_',1),'manufacturer')){n++;if(document.getElementById("dropdown_m"+n)){document.getElementById("dropdown_m"+n).style.background='#FF8A4A';if((document.getElementById(obj.id).value.lastIndexOf(',')!==-1)&&isTheSame(obj.id.split('_',1),'manufacturer')){newval=document.getElementById(obj.id).value.substr(0,document.getElementById(obj.id).value.lastIndexOf(',')+1);}else{newval='';}document.getElementById(obj.id).value=newval+document.getElementById("dropdown_m"+n).name;if(n>1){document.getElementById("dropdown_m"+eval(n-1)).style.background='';}}else{n--;}}
if(isTheSame(obj.id.split('_',1),'productName')){p++;if(document.getElementById("dropdown_p"+p)){document.getElementById("dropdown_p"+p).style.background='#FF8A4A';if((document.getElementById(obj.id).value.lastIndexOf(',')!==-1)&&isTheSame(obj.id.split('_',1),'productName')){newval=document.getElementById(obj.id).value.substr(0,document.getElementById(obj.id).value.lastIndexOf(',')+1);}else{newval='';}document.getElementById(obj.id).value=newval+document.getElementById("dropdown_p"+p).name;if(p>1){document.getElementById("dropdown_p"+eval(p-1)).style.background='';}}else{p--;}}return false;}
if(parseInt(keyCode,10)===38){if(isTheSame(obj.id.split('_',1),'manufacturer')){if(n>1){document.getElementById("dropdown_m"+eval(n-1)).style.background='#FF8A4A';if((document.getElementById(obj.id).value.lastIndexOf(',')!==-1)&&isTheSame(obj.id.split('_',1),'manufacturer')){newval=document.getElementById(obj.id).value.substr(0,document.getElementById(obj.id).value.lastIndexOf(',')+1);}else{newval='';}document.getElementById(obj.id).value=newval+document.getElementById("dropdown_m"+eval(n-1)).name;document.getElementById("dropdown_m"+n).style.background='';n--;return false;}else{return false;}}
if(isTheSame(obj.id.split('_',1),'productName')){if(p>1){document.getElementById("dropdown_p"+eval(p-1)).style.background='#FF8A4A';if((document.getElementById(obj.id).value.lastIndexOf(',')!==-1)&&isTheSame(obj.id.split('_',1),'productName')){newval=document.getElementById(obj.id).value.substr(0,document.getElementById(obj.id).value.lastIndexOf(',')+1);}else{newval='';}document.getElementById(obj.id).value=newval+document.getElementById("dropdown_p"+eval(p-1)).name;document.getElementById("dropdown_p"+p).style.background='';p--;return false;}else{return false;}}}
n=0;p=0;var keyValue=obj.value;var keyValue1='';var manuf_fieldName=document.getElementById('manufacturerName').value;if(keyValue.lastIndexOf(',')!==-1&&obj.id!==''&&isTheSame(obj.id,manuf_fieldName)){keyValue1=keyValue.substr(keyValue.lastIndexOf(',')+1);}var isManufacturer='';if(isTheSame(manuf_fieldName,obj.id)){isManufacturer='manufacturer';}else{isManufacturer='';}var wrdlen=0;check_timeout=setTimeout(function(){if(keyValue1){wrdlen=keyValue1.length;url='search_text_add_product_ajax.php?queryString='+keyValue1+'&searchField='+obj.id+'&isManufacturer='+isManufacturer;}else{wrdlen=keyValue.length;url='search_text_add_product_ajax.php?queryString='+keyValue+'&searchField='+obj.id+'&isManufacturer='+isManufacturer;}if(wrdlen>1){http=createRequestObject();globalObj=obj;http.onreadystatechange=lookup_response_1;http.open("GET",url);http.send(null);}
else{document.getElementById(obj.id+"_autoSuggestionsList").className='searchresults starthidden';document.getElementById(obj.id+"_autoSuggestionsList").innerHTML='';document.getElementById(obj.id).className='fancylabel';}},1000);}
function fill_1(val1,fields){var val=val1.replace("\\","");autoSuggestionsList=fields+'_autoSuggestionsList';document.getElementById(autoSuggestionsList).className='searchresults starthidden';document.getElementById(fields).className='fancylabel';document.getElementById(fields).value=document.getElementById(fields).value.substr(0,document.getElementById(fields).value.lastIndexOf(',')+1)+val;}
function hideListDiv2(val){var manuf_fieldName=document.getElementById('manufacturerName').value;var manufacturer_suggestions=manuf_fieldName+"_autoSuggestionsList";if(val){document.onclick=function onclick(event){if(document.getElementById('cntofanchorManu')){if(document.getElementById('cntofanchorManu').value){document.getElementById(manufacturer_suggestions).className='searchresults starthidden';document.getElementById(manuf_fieldName).className='fancylabel';}}};}}
function showDiv2(val){var manuf_fieldName=document.getElementById('manufacturerName').value;var manufacturer_suggestions=manuf_fieldName+"_autoSuggestionsList";var productNameId=document.getElementById('productNameId').value;var productName_suggestions=productNameId+"_autoSuggestionsList";document.getElementById(productName_suggestions).className='searchresults starthidden';document.getElementById(productNameId).className='fancylabel';if(val){if(document.getElementById('cntofanchorManu')){if(document.getElementById('cntofanchorManu').value){document.onclick='';document.getElementById(manufacturer_suggestions).className='searchresults starthiddenshow';document.getElementById(manuf_fieldName).className='query fancylabel results';}}}}
function hideListDivProd(val){var productNameId=document.getElementById('productNameId').value;var productName_suggestions=productNameId+"_autoSuggestionsList";if(val){document.onclick=function onclick(event){if(document.getElementById('cntofanchorProduct')){if(document.getElementById('cntofanchorProduct').value){document.getElementById(productName_suggestions).className='searchresults starthidden';document.getElementById(productNameId).className='fancylabel';}}};}}
function showDivProd(val){var productNameId=document.getElementById('productNameId').value;var productName_suggestions=productNameId+"_autoSuggestionsList";var manuf_fieldName=document.getElementById('manufacturerName').value;var manufacturer_suggestions=manuf_fieldName+"_autoSuggestionsList";document.getElementById(manufacturer_suggestions).className='searchresults starthidden';document.getElementById(manuf_fieldName).className='fancylabel';if(val){if(document.getElementById('cntofanchorProduct')){if(document.getElementById('cntofanchorProduct').value){document.onclick='';document.getElementById(productName_suggestions).className='searchresults starthiddenshow';document.getElementById(productNameId).className='query fancylabel results';}}}}
function checkavalability(){var sF=document.check_form;sF.company_name.className='';if(isEmpty(sF.company_name.value)){document.getElementById("alert_msg1").innerHTML="Please enter a company name.";sF.company_name.className='validation-fail';return false;}var sefaction=sF.company_name.value+'/register';sefaction=sefaction.toLowerCase();sF.action=sefaction;sF.submit();}
function accountTypeCheck(val){var sF=document.accounttype;document.getElementById("account_type").value=val;sF.submit();}
function add_it_user(pid,user){var f=document.addFix;for(var i=1;i<=eval(addMorefixCount);i++){var title="title"+i;var description="description"+i;if(result.find(i)&&result.length>0){}
else{if(document.getElementById("div_prob"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('problem_'+title).innerHTML='';document.getElementById('problem_'+description).innerHTML='';if(document.getElementById(title)){if(isEmpty(document.getElementById(title).value)||(document.getElementById(title).value==="Eg: Won't switch off ...")){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('problem_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}}
if(document.getElementById(description)){if(isEmpty(document.getElementById(description).value)||(document.getElementById(description).value==="Describe the problem in full ...")){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('problem_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}}
if(user==='Y'){for(var i=1; i <= eval(addMorefixCount); i++){var description = "description"+i;if(document.getElementById("div_prob"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}f.pid.value=pid;f.fixcnt.value=addMorefixCount;f.removedfixcnt.value=deleteedFixRowId;f.action='user_action.php?action_type=add_fix';f.submit();}
else{window.scrollTo(0,0);document.getElementById("modalidea").className='modal';document.getElementById('overlay').style.display='block';}}
function changePassword(){if(document.getElementById("password-changer").className==='starthidden'){document.getElementById("password-changer").className='';document.getElementById("changePasswordText").innerHTML='cancel';document.getElementById("isChangePassword").value="Y";}
else{document.getElementById("password-changer").className='starthidden';document.getElementById("changePasswordText").innerHTML='change your password';document.getElementById("isChangePassword").value="N";}}
function checkUserName_change_email_response(){if(http.readyState===4){var r=http.responseText;var f=document.form1;if(r==='false'){document.getElementById("user_alertmsg").style.display='block';document.getElementById("user_alertmsg").innerHTML="Please enter different Email Id, Email Id already exists";f.u_email.focus();}else{f.action="user_action.php?limit="+document.getElementById('limit').value;f.submit();}}}
function checkUserName_change_email(email){var url='check_user_name.php?email='+email+'&checkUser=email';http=createRequestObject();http.onreadystatechange=checkUserName_change_email_response;http.open("GET",url);http.send(null);}
function saveit(){var f=document.form1;document.getElementById("user_alertmsg").innerHTML='&nbsp;';f.firstname.className='';f.lastname.className='';f.title.className='';f.u_country.className='';f.u_password.className='';f.conf_u_password.className='';if(document.getElementById("acceptinvi").value==='Y'){if(isEmpty(f.firstname.value)){document.getElementById("user_alertmsg").innerHTML='Please enter firstname';f.firstname.className='validation-fail';f.firstname.focus();scroll(0,100);return false;}
if(isEmpty(f.lastname.value)){document.getElementById("user_alertmsg").innerHTML='Please enter lastname';f.lastname.className='validation-fail';f.lastname.focus();scroll(0,100);return false;}
if(isEmpty(f.title.value)){document.getElementById("user_alertmsg").innerHTML='Please enter title';f.title.className='validation-fail';f.title.focus();scroll(0,100);return false;}}
if(isEmpty(f.u_email.value)&&document.getElementById("isChangeEmail").value==="Y"){document.getElementById("user_alertmsg").innerHTML='Please enter Email';f.u_email.className='validation-fail';f.u_email.focus();scroll(0,100);return false;}
if(!isEmail(f.u_email.value)&&document.getElementById("isChangeEmail").value==="Y"){document.getElementById("user_alertmsg").innerHTML='Please enter valid Email';f.u_email.className='validation-fail';f.u_email.focus();return false;}
if(parseInt(f.u_country.value,10)===''||parseInt(f.u_country.value,10)===0){document.getElementById("user_alertmsg").innerHTML='Please select Country';f.u_country.className='validation-fail';f.u_country.focus();scroll(0,100);return false;}
if(isEmpty(f.u_zipcode.value)&&parseInt(f.u_country.value,10)===254){document.getElementById("user_alertmsg").innerHTML='Please select Zipcode';f.u_zipcode.className='validation-fail';f.u_zipcode.focus();scroll(0,100);return false;}
if(isEmpty(f.u_password.value)&&document.getElementById("isChangePassword").value==="Y"){document.getElementById("user_alertmsg").innerHTML='Please enter a Password';f.u_password.className='validation-fail';f.u_password.focus();scroll(0,100);return false;}
if(f.u_password.value.length<6&&document.getElementById("isChangePassword").value==="Y"){document.getElementById("user_alertmsg").innerHTML='Password length should be greater than 6';f.u_password.className='validation-fail';f.u_password.focus();scroll(0,100);return false;}
if(f.u_password.value!==f.conf_u_password.value&&document.getElementById("isChangePassword").value==="Y"){document.getElementById("user_alertmsg").innerHTML='Please enter correct Confirm Password';f.conf_u_password.className='validation-fail';f.conf_u_password.focus();scroll(0,100);return false;}
f.action_type.value='update_profile';if(document.getElementById("isChangeEmail").value==="Y"){checkUserName_change_email(f.u_email.value);}else{f.action="user_action.php?limit="+document.getElementById('limit').value;f.submit();}}
function delete_profile(){if(confirm("Are you sure you want to delete your profile?")){location.href='user_action.php?action_type=delete_profile';}}
function checkCompanyNameSignUpResponse(){if(http.readyState===4){var r=http.responseText;var f=document.add_company;if(r==='username'){document.getElementById("sign_up_alert_comp").innerHTML='Please enter different Username, Username already exists';f.public_nickname.focus();return false;}else if(r==='email'){document.getElementById("sign_up_alert_comp").innerHTML='Please enter different Email Id, Email Id already exists';f.com_email.focus();window.scroll(0,260);return false;}else if(r==='account'){document.getElementById("company_details_id").style.display="none";document.getElementById("company_account_id").style.display="";}else{f.submit();}}}
function checkCompanyNameSignUp(parameter){var url='check_company_users.php?queryString='+parameter+'&page=addemp';http=createRequestObject();http.onreadystatechange=checkCompanyNameSignUpResponse;http.open("GET",url);http.send(null);}
function companySignUp(){var strcheck,domain,parameter;var f=document.add_company;document.getElementById("sign_up_alert_comp").innerHTML='&nbsp;';if(isEmpty(f.public_nickname.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Username';f.public_nickname.focus();window.scroll(0,260);return false;}
if(isEmpty(f.firstname.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter a First Name';f.firstname.focus();window.scroll(0,260);return false;}
if(isEmpty(f.lastname.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter a Last Name';f.lastname.focus();window.scroll(0,260);return false;}
if(f.com_password.value.length<6){document.getElementById("sign_up_alert_comp").innerHTML='Password length should be greater than 6';f.com_password.focus();window.scroll(0,260);return false;}
if(f.com_password.value!==f.com_confirm_password.value){document.getElementById("sign_up_alert_comp").innerHTML='Please enter correct Confirm Password';f.com_confirm_password.focus();window.scroll(0,260);return false;}
if(isEmpty(f.com_email.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Email';f.com_email.focus();window.scroll(0,260);return false;}
if(!isEmail(f.com_email.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter valid Email Id';f.com_email.focus();window.scroll(0,260);return false;}
if(document.getElementById("account_type").value==='prof'){strcheck=f.com_email.value;domain=strcheck.substring(strcheck.indexOf('@')+1,strcheck.length);if(domain.substr(0,domain.lastIndexOf('.'))==='gmail'||domain.substr(0,domain.lastIndexOf('.'))==='yahoo'||domain.substr(0,domain.lastIndexOf('.'))==='hotmail')
{document.getElementById("sign_up_alert_comp").innerHTML='Sorry! You entered an invalid email address. Please renter your email address. For professional company accounts, free email accounts such as Gmail, Hotmail are not allowed.';f.com_email.focus();window.scroll(0,260);return false;}}
if(document.getElementById("emailChanged").value==='Y'){if(isEmpty(f.com_new_email.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Email';f.com_new_email.focus();window.scroll(0,260);return false;}
if(!isEmail(f.com_new_email.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter valid Email Id';f.com_new_email.focus();window.scroll(0,260);return false;}
if(document.getElementById("account_type").value==='prof'){strcheck=f.com_new_email.value;domain=strcheck.substring(strcheck.indexOf('@')+1,strcheck.length);if(domain.substr(0,domain.lastIndexOf('.'))==='gmail'||domain.substr(0,domain.lastIndexOf('.'))==='yahoo'||domain.substr(0,domain.lastIndexOf('.'))==='hotmail')
{document.getElementById("sign_up_alert_comp").innerHTML='Sorry! You entered an invalid email address. Please renter your email address. For professional company accounts, free email accounts such as Gmail, Hotmail are not allowed.';f.com_new_email.focus();window.scroll(0,260);return false;}}}
if(isEmpty(f.title.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Title';f.title.focus();window.scroll(0,260);return false;}
if(isEmpty(f.phone_number.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Phone Number';f.phone_number.focus();window.scroll(0,260);return false;}
if(!isInteger(f.phone_number.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter valid Phone Number';f.phone_number.focus();window.scroll(0,260);return false;}document.getElementById("public_nickname").disabled=false;document.getElementById("com_email").disabled=false;if(document.getElementById("account_type").value==='free'){}
if(document.getElementById("user_exits").value==='Y'){if(document.getElementById("emailChanged").value==='Y'){parameter=''+'@@@'+f.com_new_email.value;checkCompanyNameSignUp(parameter);}else{f.submit();}}else{parameter=f.public_nickname.value+'@@@'+f.com_email.value;checkCompanyNameSignUp(parameter);}}
function companyProfileUpdateResponse(){if(http.readyState===4){var r=http.responseText;var f=document.update_profile;if(r==='username'){document.getElementById("sign_up_alert_comp").innerHTML='Please enter different Username, Username already exists';f.public_nickname.focus();window.scroll(0,210);return false;}else if(r==='email'){document.getElementById("sign_up_alert_comp").innerHTML='Please enter different Email Id, Email Id already exists';f.u_email.focus();window.scroll(0,210);return false;}else{f.action='update_company_action.php';f.submit();}}}
function companyProfileUpdatecheck(parameter){var url='check_company_users.php?queryString='+parameter+'&page=checkemail';http=createRequestObject();http.onreadystatechange=companyProfileUpdateResponse;http.open("GET",url);http.send(null);}
function companyProfileUpdate(){var parameter;var f=document.update_profile;document.getElementById("sign_up_alert_comp").innerHTML='';if(parseInt(f.case_num.value,10)===5){if(isEmpty(f.emp_name.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Name';f.emp_name.focus();window.scroll(0,260);return false;}if(isEmpty(f.emp_title.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Title';f.emp_title.focus();window.scroll(0,260);return false;}}else{if(isEmpty(f.public_nickname.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Username';f.public_nickname.focus();window.scroll(0,210);return false;}
if(isEmpty(f.firstname.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter a First Name';f.firstname.focus();window.scroll(0,210);return false;}
if(isEmpty(f.lastname.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter a Last Name';f.lastname.focus();window.scroll(0,210);return false;}
if(f.com_password.value.length<6&&document.getElementById("isChangePassword").value==="Y"){document.getElementById("sign_up_alert_comp").innerHTML='Password length should be greater than 6';f.com_password.focus();window.scroll(0,210);return false;}
if(f.com_password.value!==f.com_confirm_password.value&&document.getElementById("isChangePassword").value==="Y"){document.getElementById("sign_up_alert_comp").innerHTML='Please enter correct Confirm Password';f.com_confirm_password.focus();window.scroll(0,210);return false;}
if(document.getElementById("isChangeEmail").value==="Y"){if(isEmpty(f.u_email.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Email';f.u_email.focus();window.scroll(0,210);return false;}
if(!isEmail(f.u_email.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter valid Email Id';f.u_email.focus();window.scroll(0,210);return false;}
var strcheck=f.u_email.value;var domain=strcheck.substring(strcheck.indexOf('@')+1,strcheck.length);if(domain.substr(0,domain.lastIndexOf('.'))==='gmail'||domain.substr(0,domain.lastIndexOf('.'))==='yahoo'||domain.substr(0,domain.lastIndexOf('.'))==='hotmail')
{document.getElementById("sign_up_alert_comp").innerHTML='Sorry! You entered an invalid email address. Please renter your email address. For professional company accounts, free email accounts such as Gmail, Hotmail are not allowed.';f.u_email.focus();window.scroll(0,210);return false;}}
if(isEmpty(f.title.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Title';f.title.focus();window.scroll(0,210);return false;}
if(isEmpty(f.phone_number.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Phone Number';f.phone_number.focus();window.scroll(0,210);return false;}
if(!isInteger(f.phone_number.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter valid Phone Number';f.phone_number.focus();window.scroll(0,210);return false;}
if(isEmpty(f.street.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Street';f.street.focus();window.scroll(0,210);return false;}
if(isEmpty(f.city.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter City';f.city.focus();window.scroll(0,210);return false;}
if(isEmpty(f.province.value)&&parseInt(f.country.value,10)===254){document.getElementById("sign_up_alert_comp").innerHTML='Please enter State/Province';f.province.focus();window.scroll(0,210);return false;}
if(parseInt(f.country.value,10)===''||parseInt(f.country.value,10)===0){document.getElementById("sign_up_alert_comp").innerHTML='Please select Country';f.country.focus();window.scroll(0,210);return false;}
if(isEmpty(f.zipcode.value)&&parseInt(f.country.value,10)===254){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Zipcode';f.zipcode.focus();window.scroll(0,210);return false;}
if(!isNumber(f.zipcode.value)&&parseInt(f.country.value,10)===254){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Valid Zipcode';f.zipcode.focus();window.scroll(0,210);return false;}
if((document.getElementById("account_type").value==='free')&&(document.getElementById("user_class").value==='ADMIN')){if(isEmpty(f.additional_info.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Additional Information';f.additional_info.focus();window.scroll(0,210);return false;}}}
if(document.getElementById("isChangeEmail").value==="Y"){parameter=f.u_id.value+'@@@'+f.public_nickname.value+'@@@'+f.u_email.value;companyProfileUpdatecheck(parameter);}else{parameter=f.u_id.value+'@@@'+f.public_nickname.value;companyProfileUpdatecheck(parameter);}}
function checkCompanyNameResponse(){if(http.readyState===4){var r=http.responseText;var f=document.add_employee;if(r==='username'){document.getElementById("emp_name_alert").innerHTML='Please enter different Username, Username already exists';f.emp_name.className='validation-fail';f.emp_name.focus();return false;}else if(r==='email'){document.getElementById("emp_email_alert").innerHTML='Please enter different Email Id, Email Id already exists';f.emp_email.className='validation-fail';f.emp_email.focus();return false;}else{f.submit();}}}
function checkCompanyName(parameter){var url='check_company_users.php?queryString='+parameter+'&page=addemp';http=createRequestObject();http.onreadystatechange=checkCompanyNameResponse;http.open("GET",url);http.send(null);}
function addEmployee(){var f=document.add_employee;f.emp_name.className='';f.emp_title.className='';f.emp_email.className='';document.getElementById("emp_name_alert").innerHTML='';document.getElementById("emp_title_alert").innerHTML='';document.getElementById("emp_email_alert").innerHTML='';if(isEmpty(f.emp_name.value)){document.getElementById("emp_name_alert").innerHTML='Please enter Name';f.emp_name.className='validation-fail';f.emp_name.focus();return false;}
if(isEmpty(f.emp_title.value)){document.getElementById("emp_title_alert").innerHTML='Please enter Title';f.emp_title.className='validation-fail';f.emp_title.focus();return false;}if(isEmpty(f.emp_email.value)){document.getElementById("emp_email_alert").innerHTML='Please enter Email';f.emp_email.className='validation-fail';f.emp_email.focus();return false;}if(!isEmail(f.emp_email.value)){document.getElementById("emp_email_alert").innerHTML='Please enter valid Email Id';f.emp_email.className='validation-fail';f.emp_email.focus();return false;}f.emp_name.disabled=false;f.emp_email.disabled=false;if(f.user_exits.value==='Y'){f.submit();}else{var parameter=f.emp_name.value+'@@@'+f.emp_email.value;checkCompanyName(parameter);}}
function backOncheckPage(){var f=document.add_company;f.action=f.company_name.value+'/register';f.submit();}
function showProductDiv(id,name,type){if(document.getElementById("productFixDiv_"+id+"_"+type).style.display==='none'){document.getElementById("productName_"+id+"_"+type).innerHTML='- '+name;document.getElementById("productFixDiv_"+id+"_"+type).style.display='';}
else{document.getElementById("productName_"+id+"_"+type).innerHTML='+ '+name;document.getElementById("productFixDiv_"+id+"_"+type).style.display='none';}}
function changefixideaTab(name){if(name==='fixesTab'){document.getElementById(name).style.display='';document.getElementById('ideasTab').style.display='none';document.getElementById('fixeslistTab').style.display='none';document.getElementById('ideaslistTab').style.display='none';document.getElementById('ideasbutton').style.background='';document.getElementById('fixesbutton').style.background='#FFFF99';}
if(name==='ideasTab'){document.getElementById(name).style.display='';document.getElementById('fixesTab').style.display='none';document.getElementById('fixeslistTab').style.display='none';document.getElementById('ideaslistTab').style.display='none';document.getElementById('ideasbutton').style.background='#FFFF99';document.getElementById('fixesbutton').style.background='';}}
function changefixeslistTab(name){document.getElementById(name).style.display='';document.getElementById('ideasTab').style.display='none';document.getElementById('fixesTab').style.display='none';}
var emp_id_edit='';function employeeEdit_Response(){if(http.readyState===4){var r=http.responseText;var divID="";divID="priceListDiv";document.getElementById("priceListDiv").style.display='';if(document.getElementById("priceListDiv")){document.getElementById("priceListDiv").innerHTML=r;}}}
function employeeEdit(id){var url="company_employee_ajax.php?id="+id;emp_id_edit=id;http=createRequestObject();http.onreadystatechange=employeeEdit_Response;http.open("GET",url);http.send(null);}
function employeeEditHide(id){document.getElementById('priceListDiv').style.display='none';}
function removeemployeeResponse(){if(http.readyState===4){var r=http.responseText;document.getElementById("allEmployeesCnt").value=eval(parseInt(document.getElementById("allEmployeesCnt").value,10)-1);if(parseInt(document.getElementById("allEmployeesCnt").value,10)===0){document.getElementById("admin_to_employee").innerHTML='Employee is Removed';document.getElementById("priceListDiv").style.display='none';document.getElementById("emp_list_div").style.display='none';document.getElementById("add_employee_table_id").style.display='';}
else{document.getElementById("admin_to_employee").style.display='';document.getElementById("priceListDiv").style.display='none';document.getElementById("emp_list_div").innerHTML=r;document.getElementById("admin_to_employee").innerHTML='Employee is Removed';}}}
function removeemployee(id){if(confirm("Are you sure? You want to delete this employee.")){var url='approve_employee.php?emp_id='+id+'&page=remove';http=createRequestObject();http.onreadystatechange=removeemployeeResponse;http.open("GET",url);http.send(null);}}
function sendPasswordResetResponse(){if(http.readyState===4){var r=http.responseText;document.getElementById("admin_to_employee").innerHTML='Password reset link sent';document.getElementById("priceListDiv").style.display='none';}}
function sendPasswordReset(id){var url='approve_employee.php?emp_id='+id+'&page=resetpw';http=createRequestObject();http.onreadystatechange=sendPasswordResetResponse;http.open("GET",url);http.send(null);}
function showModerator(id){document.getElementById("moderatorDiv_"+id).style.display='';}
function moderatorHide(id){document.getElementById("moderatorDiv_"+id).style.display='none';}var emp_id=0;function makeModeratorResponse(){if(http.readyState===4){var r=http.responseText;document.getElementById("admin_to_employee").innerHTML='Moderator added';document.getElementById("priceListDiv").style.display='none';}}
function makeModerator(id,count){var j='';var m='';var removeEmpId='';for(var i=1;i<=count;i++){m++;var makemodid='makeModecheck_'+i;if(!(document.getElementById(makemodid).checked)){if(j>0){removeEmpId+=',';}removeEmpId+=document.getElementById(makemodid).value;j=1;m--;}}if(m>3){document.getElementById("addModeratorAlert").style.display='';return false;}var url='approve_employee.php?emp_id='+id+'&page=makemode&removeid='+removeEmpId;http=createRequestObject();http.onreadystatechange=makeModeratorResponse;http.open("GET",url);http.send(null);}
function approve_employee_response(){if(http.readyState===4){var r=http.responseText;var split_res=r.split("###");if(parseInt(document.getElementById("allEmployeesCnt").value,10)===0){document.getElementById("emp_list_div").style.display='';document.getElementById("add_employee_table_id").style.display='none';}if(document.getElementById("emp_list_div")){document.getElementById("emp_list_div").innerHTML=split_res[0];}if(document.getElementById("unApprovedEmplist")){document.getElementById("unApprovedEmplist").innerHTML=split_res[1];}document.getElementById("admin_to_employee").innerHTML='Employee is Approved';document.getElementById("allEmployeesCnt").value=eval(parseInt(document.getElementById("allEmployeesCnt").value,10)+1);}}
function approveEmployee(id){emp_id=id;var url='approve_employee.php?emp_id='+id+'&page=approve';http=createRequestObject();http.onreadystatechange=approve_employee_response;http.open("GET",url);http.send(null);}
function denyEmployeeResponse(){if(http.readyState===4){var r=http.responseText;document.getElementById("unApprovedEmplist").innerHTML=r;document.getElementById("admin_to_employee").innerHTML='Employee is Denied';}}
function denyEmployee(id){emp_id=id;var url='approve_employee.php?emp_id='+id+'&page=deny';http=createRequestObject();http.onreadystatechange=denyEmployeeResponse;http.open("GET",url);http.send(null);}
var deletedEmpRowId='';var deletedEmpRowCnt=0;var resultEmp=[];var emp_cnt=1;function createFields1(emp_cnt){var newdiv,divid,content,container;newdiv=document.createElement("div");newdiv.setAttribute("name",'emp_div'+emp_cnt);newdiv.setAttribute("id",'emp_div'+emp_cnt);divid='emp_div'+emp_cnt;content='<p><label for=add_empname'+emp_cnt+'>Name <a id=anchor'+emp_cnt+' href=javascript:removeEmpyoyeeRow('+emp_cnt+') >Remove</a></label><input name=add_empname'+emp_cnt+' id=add_empname'+emp_cnt+' size="45" type="text"><span id=name_add_empname'+emp_cnt+' class="error-msg"></span></p>';content+='<p><label for=add_emptitle'+emp_cnt+'>Title</label><input name=add_emptitle'+emp_cnt+' id=add_emptitle'+emp_cnt+' size="45" type="text"><span id=title_add_emptitle'+emp_cnt+' class="error-msg"></span></p>';content+='<p><label for=add_empemail'+emp_cnt+'>Email Address</label><input name=add_empemail'+emp_cnt+' id=add_empemail'+emp_cnt+' size="45" type="text"><span id=email_add_empemail'+emp_cnt+' class="error-msg"></span></p>';newdiv.innerHTML=content;container=document.getElementById("addmoredivs");container.appendChild(newdiv);}
function add_more_employees(){for(var i=1;i<=eval(emp_cnt);i++){var name="add_empname"+i;var title="add_emptitle"+i;var email="add_empemail"+i;if(resultEmp.find(i)&&resultEmp.length>0){}
else{if(document.getElementById("emp_div"+i)){document.getElementById(name).className='fancylabel';document.getElementById(title).className='fancylabel';document.getElementById(email).className='fancylabel';document.getElementById('name_'+name).innerHTML='';document.getElementById('title_'+title).innerHTML='';document.getElementById('email_'+email).innerHTML='';if(isEmpty(document.getElementById(name).value)){document.getElementById(name).className='fancylabel validation-fail';document.getElementById('name_'+name).innerHTML="Please enter the Name";document.getElementById(name).focus();return false;}
if(isEmpty(document.getElementById(title).value)){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('title_'+title).innerHTML="Please enter the title";document.getElementById(title).focus();return false;}
if(isEmpty(document.getElementById(email).value)){document.getElementById(email).className='fancylabel validation-fail';document.getElementById('email_'+email).innerHTML="Please enter the Email";document.getElementById(email).focus();return false;}
if(!isEmail(document.getElementById(email).value)){document.getElementById(email).className='fancylabel validation-fail';document.getElementById('email_'+email).innerHTML="Please enter Valid Email";document.getElementById(email).focus();return false;}}}}emp_cnt=eval(emp_cnt+1);createFields1(emp_cnt);}
function removeEmpyoyeeRow(divNum){deletedEmpRowCnt++;resultEmp[deletedEmpRowCnt]=divNum;if(deletedEmpRowId){deletedEmpRowId=deletedEmpRowId+','+divNum;}else{deletedEmpRowId=divNum;}var d1=document.getElementById('addmoredivs');var d2=document.getElementById('emp_div'+divNum);d1.removeChild(d2);var m=1;for(var i=1;i<=eval(emp_cnt);i++){var name="add_empname"+i;var email="add_empemail"+i;if(resultEmp.find(i)&&resultEmp.length>0){}else{if(i!==1){m++;}}}}
function alertEmpContents(){if(http_request.readyState===4){if(http_request.status===200){var result=http_request.responseText;var field_name1;if(result){result=result.split('@@@');var the_length=result[0].length;var last_char=result[0].charAt(eval(the_length-1));var field_name=result[0].replace('add_emp','').replace(last_char,'');if(last_char>1){field_name1=result[0].replace(last_char,eval(parseInt(deletedEmpRowCnt,10)+parseInt(last_char,10)));}else{field_name1=result[0];}document.getElementById(field_name1).className='fancylabel validation-fail';document.getElementById(field_name+'_'+field_name1).innerHTML="Please enter different "+field_name+", Employee "+eval(parseInt(last_char,10))+" "+field_name+" already "+result[1];document.getElementById(field_name1).focus();return false;}else{var f=document.addemployee;f.deletedEmpRowId.value=deletedEmpRowId;f.action='add_employee_action.php';f.submit();}}else{alert('There was a problem with the request.');}}}
function makePOSTRequest(url,parameters){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){}}}if(!http_request){alert('Cannot create XMLHTTP instance');return false;}http_request.onreadystatechange=alertEmpContents;http_request.open('POST',url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function addEmployees(){var i,name,title,email,name1,email1,nameval,emailval;var str_parameter='';for(i=1;i<=eval(emp_cnt);i++){name="add_empname"+i;title="add_emptitle"+i;email="add_empemail"+i;if(resultEmp.find(i)&&resultEmp.length>0){}else{if(document.getElementById("emp_div"+i)){document.getElementById(name).className='fancylabel';document.getElementById(title).className='fancylabel';document.getElementById(email).className='fancylabel';document.getElementById('name_'+name).innerHTML='';document.getElementById('title_'+title).innerHTML='';document.getElementById('email_'+email).innerHTML='';if(isEmpty(document.getElementById(name).value)){document.getElementById(name).className='fancylabel validation-fail';document.getElementById('name_'+name).innerHTML="Please enter the Name";document.getElementById(name).focus();return false;}
if(isEmpty(document.getElementById(title).value)){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('title_'+title).innerHTML="Please enter the title";document.getElementById(title).focus();return false;}
if(isEmpty(document.getElementById(email).value)){document.getElementById(email).className='fancylabel validation-fail';document.getElementById('email_'+email).innerHTML="Please enter the Email";document.getElementById(email).focus();return false;}
if(!isEmail(document.getElementById(email).value)){document.getElementById(email).className='fancylabel validation-fail';document.getElementById('email_'+email).innerHTML="Please enter Valid Email";document.getElementById(email).focus();return false;}}}}
for(i=1;i<=emp_cnt;i++){name="add_empname"+i;email="add_empemail"+i;if(resultEmp.find(i)&&resultEmp.length>0){}else{var m=1;for(var j=1;j<=emp_cnt;j++){name1="add_empname"+j;email1="add_empemail"+j;if(resultEmp.find(j)&&resultEmp.length>0){}else{if(i!==j){if(document.getElementById(name).value===document.getElementById(name1).value){document.getElementById(name1).className='fancylabel validation-fail';document.getElementById('name_'+name1).innerHTML="Please enter different Name, Employee "+eval(m)+" Name already entered";document.getElementById(name1).focus();return false;}if(document.getElementById(email).value===document.getElementById(email1).value){document.getElementById(email1).className='fancylabel validation-fail';document.getElementById('email_'+email1).innerHTML="Please enter different Email, Employee "+eval(m)+" Email already entered";document.getElementById(email1).focus();return false;}}m++;}}}}
var n=1;for(var k=1;k<=eval(emp_cnt);k++){name="add_empname"+k;email="add_empemail"+k;if(resultEmp.find(k)&&resultEmp.length>0){}else{name1="add_empname"+n;email1="add_empemail"+n;nameval=document.getElementById(name).value;emailval=document.getElementById(email).value;str_parameter=str_parameter+name1+"###"+nameval+"###"+email1+"###"+emailval;if(k<emp_cnt){str_parameter+='#@@#';}n++;}}document.getElementById('emp_cnt').value=emp_cnt;str_parameter="allparameters="+str_parameter;makePOSTRequest('check_employee.php',str_parameter);}
function lookup_comp(obj,e){var keyCode,newval,url;clearTimeout(check_timeout);keyCode=e.keyCode||window.event.keyCode;if(parseInt(keyCode,10)===13||parseInt(keyCode,10)===27){document.getElementById(obj.id+"_autoSuggestionsList").className='searchresults starthidden';document.getElementById(obj.id).className='fancylabel';return false;}if(parseInt(keyCode,10)===40){if(isTheSame(obj.id.split('_',1),'manufacturer')){n++;if(document.getElementById("dropdown_m"+n)){document.getElementById("dropdown_m"+n).style.background='#FF8A4A';if((document.getElementById(obj.id).value.lastIndexOf(',')!==-1)&&isTheSame(obj.id.split('_',1),'productName')){newval=document.getElementById(obj.id).value.substr(0,document.getElementById(obj.id).value.lastIndexOf(',')+1);}else{newval='';}document.getElementById(obj.id).value=newval+document.getElementById("dropdown_m"+n).name;if(n>1){document.getElementById("dropdown_m"+eval(n-1)).style.background='';}}else{n--;}}
if(isTheSame(obj.id.split('_',1),'productName')){p++;if(document.getElementById("dropdown_p"+p)){document.getElementById("dropdown_p"+p).style.background='#FF8A4A';if((document.getElementById(obj.id).value.lastIndexOf(',')!==-1)&&isTheSame(obj.id.split('_',1),'productName')){newval=document.getElementById(obj.id).value.substr(0,document.getElementById(obj.id).value.lastIndexOf(',')+1);}else{newval='';}document.getElementById(obj.id).value=newval+document.getElementById("dropdown_p"+p).name;if(p>1){document.getElementById("dropdown_p"+eval(p-1)).style.background='';}}else{p--;}}return false;}if(parseInt(keyCode,10)===38){if(isTheSame(obj.id.split('_',1),'manufacturer')){if(n>1){document.getElementById("dropdown_m"+eval(n-1)).style.background='#FF8A4A';if((document.getElementById(obj.id).value.lastIndexOf(',')!==-1)&&isTheSame(obj.id.split('_',1),'productName')){newval=document.getElementById(obj.id).value.substr(0,document.getElementById(obj.id).value.lastIndexOf(',')+1);}else{newval='';}
document.getElementById(obj.id).value=newval+document.getElementById("dropdown_m"+eval(n-1)).name;document.getElementById("dropdown_m"+n).style.background='';n--;return false;}else{return false;}}if(isTheSame(obj.id.split('_',1),'productName')){if(p>1){document.getElementById("dropdown_p"+eval(p-1)).style.background='#FF8A4A';if((document.getElementById(obj.id).value.lastIndexOf(',')!==-1)&&isTheSame(obj.id.split('_',1),'productName')){newval=document.getElementById(obj.id).value.substr(0,document.getElementById(obj.id).value.lastIndexOf(',')+1);}else{newval='';}document.getElementById(obj.id).value=newval+document.getElementById("dropdown_p"+eval(p-1)).name;document.getElementById("dropdown_p"+p).style.background='';p--;return false;}else{return false;}}}n=0;p=0;m=0;var keyValue=obj.value;var keyValue1='';if(keyValue.lastIndexOf(',')!==-1&&obj.id){keyValue1=keyValue.substr(keyValue.lastIndexOf(',')+1);}
var isManufacturer='';check_timeout=setTimeout(function(){if(keyValue1){url='search_text_add_product_ajax.php?queryString='+keyValue1+'&searchField='+obj.id+'&isManufacturer='+isManufacturer;}else{url='search_text_add_product_ajax.php?queryString='+keyValue+'&searchField='+obj.id+'&isManufacturer='+isManufacturer;}http=createRequestObject();globalObj=obj;http.onreadystatechange=lookup_response_1;http.open("GET",url);http.send(null);},1000);}
function showDivProdComp(val){var productNameId=document.getElementById('productNameId').value;var productName_suggestions=productNameId+"_autoSuggestionsList";if(val){document.onclick=function onclick(event){if(document.getElementById('cntofanchorProduct')){if(document.getElementById('cntofanchorProduct').value){document.getElementById(productName_suggestions).className='searchresults';document.getElementById(productNameId).className='query fancylabel results';}}};}}
function confirmProducts(id){var form_name=document.products_fans;form_name.productId.value=id;form_name.action_type.value='confirm_product';form_name.action="user_action.php";form_name.submit();}
function removeProducts(id,name){if(confirm(name+" has been remove from your list.")){var form_name=document.products_fans;form_name.productId.value=id;form_name.action_type.value='remove_product';form_name.action="user_action.php";form_name.submit();}}
function changeCountryCompSign(obj){if(parseInt(obj,10)!==254&&parseInt(obj,10)!==0){document.getElementById("zipshow1").className="starthidden";document.getElementById("ziphide1").className="";}else{document.getElementById("zipshow1").className="";document.getElementById("ziphide1").className="starthidden";}}function companyProfileDisable(page){if(parseInt(page,10)!==1){document.getElementById('deleteOption_').style.display='';}else{if(confirm("Are you sure? You want to delete your Profile.")){var form_name=document.update_profile;form_name.action_type.value="delete_employee_profile";form_name.action="user_action.php";form_name.submit();}}}
function justDisable(){if(confirm("Are you sure? You want to delete your Profile.")){var form_name=document.update_profile;form_name.action_type.value="delete_employee_profile";form_name.action="user_action.php";form_name.submit();}}
function companyProfileDisableHide(page){document.getElementById('deleteOption_'+page).style.display='';for(i=1;i<2;i++){if(page!==i){document.getElementById('deleteOption_'+i).style.display='none';}}}
var admincount='';function makeAdminProfile(id){if(document.getElementById('new_admin_id').value!==id){document.getElementById('makeAdmin_'+id).innerHTML="Admin";document.getElementById('makeAdmin_'+id).style.textDecoration='none';document.getElementById('makeAdmin_'+id).style.cursor='default';document.getElementById('doneOnCase2Id').style.display='';if(document.getElementById('new_admin_id').value){document.getElementById('makeAdmin_'+document.getElementById('new_admin_id').value).innerHTML="Make Admin";document.getElementById('makeAdmin_'+document.getElementById('new_admin_id').value).value='';document.getElementById('makeAdmin_'+document.getElementById('new_admin_id').value).style.textDecoration='underline';document.getElementById('makeAdmin_'+document.getElementById('new_admin_id').value).style.cursor='pointer';}document.getElementById('new_admin_id').value=id;}}
function removeAdminProfile(id){if(document.getElementById('new_admin_id').value===id){document.getElementById('makeAdmin_'+id).innerHTML="Make Admin";document.getElementById('makeAdmin_'+id).value='';document.getElementById('makeAdmin_'+id).style.textDecoration='underline';document.getElementById('makeAdmin_'+id).style.cursor='pointer';document.getElementById('new_admin_id').value='';}document.getElementById('doneOnCase2Id').style.display='none';}
function doneOnCase2(){if(document.getElementById('new_admin_id').value){if(confirm("Are you sure? You want to delete your Profile.")){var form_name=document.update_profile;form_name.action_type.value="delete_profile_change_admin";form_name.action="user_action.php";form_name.submit();}}}
function cancelOnCase2(){document.getElementById('deleteOption_').style.display='none';}var admincountcase4='';function makeAdminProfileCase4(id){document.getElementById('makeAdmin_case4_'+id).innerHTML="Admin";document.getElementById('makeAdmin_case4_'+id).value='admin';document.getElementById('doneOnCase4Id').style.display='';if(admincountcase4){document.getElementById('makeAdmin_case4_'+admincountcase4).innerHTML="Make Admin";document.getElementById('makeAdmin_case4_'+admincountcase4).value='';}admincountcase4=id;}
function removeAdminProfileCase4(id){var admin='';if(admincountcase4===id){document.getElementById('makeAdmin_case4_'+id).innerHTML="Make Admin";document.getElementById('makeAdmin_case4_'+id).value='';admincountcase4='';}for(i=1;i<5;i++){if(document.getElementById('makeAdmin_case4_'+i).value==='admin'){admin=1;}}if(admin!==1){document.getElementById('doneOnCase4Id').style.display='none';}}
function doneOnCase4(){var admin='';for(i=1;i<5;i++){if(document.getElementById('makeAdmin_case4_'+i).value==='admin'){admin=1;}}if(admin===1){if(confirm("Are you sure? You want to delete your Profile.")){location.href='index.php';}}else{document.getElementById('profile_delete_alert_4').innerHTML='Please select an admin employee';}}
function cancelOnCase4(id){document.getElementById('deleteOption_'+id).style.display='none';}
function validateEmp_Response(){if(http.readyState===4){var r=http.responseText;if(r==='username'){document.getElementById("profile_delete_alert_3").innerHTML='Please enter different Employee name.';}else if(r==='email'){document.getElementById("profile_delete_alert_3").innerHTML='Please enter different Employee Email.';}else{if(confirm("Are you sure? You want to delete your Profile.")){var form_name=document.update_profile;form_name.action_type.value="delete_profile_add_admin";form_name.action="user_action.php";form_name.submit();}}}}
function doneOnCase3(){var strcheck,domain,url;if(!isEmail(document.getElementById('add_empemail').value)){document.getElementById("profile_delete_alert_3").innerHTML='Please enter valid Email Id';document.getElementById('add_empemail').focus();return false;}strcheck=document.getElementById('add_empemail').value;domain=strcheck.substring(strcheck.indexOf('@')+1,strcheck.length);if(domain.substr(0,domain.lastIndexOf('.'))==='gmail'||domain.substr(0,domain.lastIndexOf('.'))==='yahoo'||domain.substr(0,domain.lastIndexOf('.'))==='hotmail'){document.getElementById("profile_delete_alert_3").innerHTML='Sorry! You entered an invalid email address. Please renter your email address. For professional company accounts, free email accounts such as Gmail, Hotmail are not allowed.';document.getElementById('add_empemail').focus();return false;}
url="check_employee.php?checkemp=validateEmp&empname="+document.getElementById('add_empname').value+"&email="+document.getElementById('add_empemail').value;http=createRequestObject();http.onreadystatechange=validateEmp_Response;http.open("GET",url);http.send(null);}
function cancelOnCase3(id){document.getElementById('deleteOption_').style.display='none';}
function showDoneCase3(){if((document.getElementById('add_empname').value)&&(document.getElementById('add_empemail').value)){document.getElementById('doneOnCase3Id').style.display='';}else{document.getElementById('doneOnCase3Id').style.display='none';}}var emp_add_cnt=0;function add_more_employees_list(){if(document.getElementById("add_employee_table_id").className==="starthidden"){document.getElementById("add_employee_table_id").className="";document.getElementById("add_employee_lbl").innerHTML="- Add more employees";}else{document.getElementById("add_employee_table_id").className="starthidden";document.getElementById("add_employee_lbl").innerHTML="+ Add more employees";}return false;}
var deletedEmpRowId2='';var deletedEmpRowCnt2=0;var resultEmp2=[];function changefixideaTabFront(name){document.getElementById("login_section_div").innerHTML="";if(document.getElementById('priceList1_')){document.getElementById('priceList1_').innerHTML="";}if(name==='fixes_tab'){document.getElementById(name).className='starthiddenshow';document.getElementById('ideas_tab').className='starthidden';document.getElementById('ideasbutton').className='last';document.getElementById('fixesbutton').className='active';}if(name==='ideas_tab'){document.getElementById(name).className='starthiddenshow';document.getElementById('fixes_tab').className='starthidden';document.getElementById('ideasbutton').className='active last';document.getElementById('fixesbutton').className='';}}
function savedresponseIdea(){if(http.readyState===4){var r=http.responseText;var me_too_id='me_too_idea'+iid+'_div';var me_too_val='me_too_idea'+iid+'_value';document.getElementById(me_too_val).innerHTML=r;document.getElementById(me_too_id).innerHTML='<p><strong>including you!</strong></p>';}}
function me_too_fun_idea(id){var url='savefixcnt_ajax.php?iid='+id;iid=id;http=createRequestObject();http.onreadystatechange=savedresponseIdea;http.open("GET",url);http.send(null);}
function add_idea(pid){var f=document.fixlist;f.action=pid;f.submit();}
function add_idea_check_user_response(){if(http.readyState===4){var r=http.responseText;var f=document.addIdea;if(r==='false'){document.getElementById("loginAlertprob").innerHTML="The username or password you entered is incorrect.";f.login_u_username.className='validation-fail';f.login_u_username.focus();}else{for(var i=1; i <= eval(addMoreideaCount); i++){var description = "description"+i;if(document.getElementById("div_idea"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}f.action='login_action.php?action_type=add_idea_login';f.submit();}}}
function add_idea_check_user(username,password){var url='check_user_name.php?username='+username+'&password='+password+'&checkUser=yes';http=createRequestObject();http.onreadystatechange=add_idea_check_user_response;http.open("GET",url);http.send(null);}
function loginToAddIdea(pid){var f=document.addIdea;document.getElementById("loginAlertprob").innerHTML='&nbsp;';f.login_u_username.className='';f.login_u_password.className='';if(isEmpty(f.login_u_username.value)){document.getElementById("loginAlertprob").innerHTML='Please enter Username';f.login_u_username.className='validation-fail';f.login_u_username.focus();return false;}if(isEmpty(f.login_u_password.value)){document.getElementById("loginAlertprob").innerHTML='Please enter a Password';f.login_u_password.className='validation-fail';f.login_u_password.focus();return false;}f.ideacnt.value=addMoreideaCount;f.removedIdeaCnt.value=deleteedIdeaRowId;f.pid.value=pid;add_idea_check_user(f.login_u_username.value,f.login_u_password.value);}
function add_it_idea_user(pid,user){var f=document.addIdea;for(var i=1;i<=eval(addMoreideaCount);i++){var title="title"+i;var description="description"+i;if(resultIdea.find(i)&&resultIdea.length>0){}else{if(document.getElementById("div_idea"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('idea_'+title).innerHTML='';document.getElementById('idea_'+description).innerHTML='';if(document.getElementById(title)){if(isEmpty(document.getElementById(title).value)||(document.getElementById(title).value==="Eg: Turn the screen off to save the battery ...")){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('idea_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}}
if(document.getElementById(description)){if(isEmpty(document.getElementById(description).value)||(document.getElementById(description).value==="Describe the idea in full ...")){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('idea_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}}if(user==='Y'){for(var i=1; i <= eval(addMoreideaCount); i++){var description = "description"+i;if(document.getElementById("div_idea"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}f.ideacnt.value=addMoreideaCount;f.removedIdeaCnt.value=deleteedIdeaRowId;f.pid.value=pid;f.action_type.value='add_idea';f.action='user_action.php';f.submit();}else{window.scrollTo(0,0);document.getElementById("modalidea").className='modal';document.getElementById('overlay').style.display='block';}}
function checkUserName_add_it_idea_response(){if(http.readyState===4){var r=http.responseText;var f=document.addIdea;var split_res=r.split("###");if(parseInt(split_res[0],10)===1){document.getElementById("sign_up_add_it_alert").innerHTML="Please choose different Username, username already exists";f.u_username.focus();}else if(parseInt(split_res[0],10)===2){document.getElementById("sign_up_add_it_alert").innerHTML="The code you entered is not valid .";document.getElementById("conf_code1").value=split_res[1];document.getElementById("captcha_code_img1").src=split_res[2];f.captcha_code1.value='';f.captcha_code1.focus();}else if(parseInt(split_res[0],10)===4){document.getElementById("sign_up_add_it_alert").innerHTML="Please enter different Email Id, Email Id already exists";f.u_email.focus();}else{for(var i=1; i <= eval(addMoreideaCount); i++){var description = "description"+i;if(document.getElementById("div_idea"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}f.action='login_action.php?action_type=add_idea_sign_up';f.submit();}}}
function checkUserName_add_it_idea(val,email){var url='check_user_name.php?queryString='+val+'&email='+email;http=createRequestObject();http.onreadystatechange=checkUserName_add_it_idea_response;http.open("GET",url);http.send(null);}
function signup_add_it_idea(pid){var f=document.addIdea;document.getElementById("signupAlertprob").innerHTML='&nbsp;';f.u_username.className='';f.u_password.className='';f.conf_u_password.className='';f.u_country.className='';f.u_zipcode1.className='';f.u_email.className='';f.captcha_code1.className='';if(isEmpty(f.u_username.value)){document.getElementById("signupAlertprob").innerHTML='Please enter Username';f.u_username.className='validation-fail';f.u_username.focus();return false;}
if(isEmpty(f.u_password.value)){document.getElementById("signupAlertprob").innerHTML='Please enter a Password';f.u_password.className='validation-fail';f.u_password.focus();return false;}if(f.u_password.value.length<6){document.getElementById("signupAlertprob").innerHTML='Password length should be greater than 6';f.u_password.className='validation-fail';f.u_password.focus();return false;}if(f.u_password.value!==f.conf_u_password.value){document.getElementById("signupAlertprob").innerHTML='Please enter correct Confirm Password';f.conf_u_password.className='validation-fail';f.conf_u_password.focus();return false;}if(isEmpty(f.u_email.value)){document.getElementById("signupAlertprob").innerHTML='Please enter Email';f.u_email.className='validation-fail';f.u_email.focus();return false;}if(parseInt(f.u_country.value,10)===''||parseInt(f.u_country.value,10)===0){document.getElementById("signupAlertprob").innerHTML='Please select Country';f.u_country.className='validation-fail';f.u_country.focus();return false;}
if(isEmpty(f.u_zipcode1.value)&&parseInt(f.u_country.value,10)===254){document.getElementById("signupAlertprob").innerHTML='Please enter Zipcode';f.u_zipcode1.className='validation-fail';f.u_zipcode1.focus();return false;}if(isEmpty(f.captcha_code1.value)){document.getElementById("signupAlertprob").innerHTML='Please enter the answer';f.captcha_code1.className='validation-fail';f.captcha_code1.focus();return false;}
if(eval(parseInt(f.first_var_idea.value,10)+parseInt(f.second_var_idea.value,10))!==parseInt(f.captcha_code1.value,10)){document.getElementById("signupAlertprob").innerHTML='Please enter the correct answer';var rand_first_var=Math.floor((9-1)*Math.random())+1;f.first_var_idea.value=rand_first_var;document.getElementById("first_num_fix").innerHTML=rand_first_var;var rand_second_var=Math.floor((9-1)*Math.random())+1;f.second_var_idea.value=rand_second_var;document.getElementById("second_num_fix").innerHTML=rand_second_var;f.captcha_code1.className='validation-fail';f.captcha_code1.focus();return false;}f.ideacnt.value=addMoreideaCount;f.removedIdeaCnt.value=deleteedIdeaRowId;f.pid.value=pid;checkUserName_add_it_idea(f.u_username.value,f.u_email.value);}
function changefixideaTabUser(name){if(name==='fixes_tab_user'){document.getElementById(name).className='';document.getElementById('ideas_tab_user').className='starthidden';}
if(name==='ideas_tab_user'){document.getElementById(name).className='';document.getElementById('fixes_tab_user').className='starthidden';}}
function changeEmail(){if(document.getElementById("email-changer").className==='starthidden'){document.getElementById("email-changer").className='';document.getElementById("changeEmailText").innerHTML='cancel';document.getElementById("isChangeEmail").value="Y";}
else{document.getElementById("email-changer").className='starthidden';document.getElementById("changeEmailText").innerHTML='change email address';document.getElementById("isChangeEmail").value="N";}}
function forgotpwlink(){var f=document.forgotpw;document.getElementById("forgotpw_alert").innerHTML='';if(isEmpty(f.forgot_email.value)){document.getElementById("forgotpw_alert").innerHTML='Please enter Email';f.forgot_email.focus();return false;}
if(!isEmail(f.forgot_email.value)){document.getElementById("forgotpw_alert").innerHTML='Please enter valid Email Id';f.forgot_email.focus();return false;}
var strcheck=f.forgot_email.value;var domain=strcheck.substring(strcheck.indexOf('@')+1,strcheck.length);if(domain.substr(0,domain.lastIndexOf('.'))==='gmail'||domain.substr(0,domain.lastIndexOf('.'))==='yahoo'||domain.substr(0,domain.lastIndexOf('.'))==='hotmail'){document.getElementById("forgotpw_alert").innerHTML='Sorry! You entered an invalid email address. Please renter your email address. For professional company accounts, free email accounts such as Gmail, Hotmail are not allowed.';f.forgot_email.focus();return false;}
document.getElementById("page").value='forgotpwAction';f.action='register.php';f.submit();}
function resetpassword(){var f=document.resetpw;document.getElementById("resetpw_alert").innerHTML='';if(f.reset_password.value.length<6){document.getElementById("resetpw_alert").innerHTML='Password length should be greater than 6';f.reset_password.focus();return false;}
if(f.reset_password.value!==f.reset_password2.value){document.getElementById("resetpw_alert").innerHTML='Please enter correct Confirm Password';f.reset_password2.focus();return false;}
document.getElementById("page").value='resetpwAction';f.action='register.php';f.submit();}
function checkSetUserNameResponse(){if(http.readyState===4){var r=http.responseText;var f=document.resetpw;if(r==='username'){document.getElementById("resetpw_alert").innerHTML='Please enter different Username, Username already exists';f.reset_username.focus();return false;}else{f.action='register.php';f.submit();}}}
function checkSetUserName(parameter){var url='check_company_users.php?queryString='+parameter+'&page=addemp';http=createRequestObject();http.onreadystatechange=checkSetUserNameResponse;http.open("GET",url);http.send(null);}
function setuserpassword(){var f=document.resetpw;document.getElementById("resetpw_alert").innerHTML='';if(isEmpty(f.reset_username.value)){document.getElementById("resetpw_alert").innerHTML='Enter the username';f.reset_username.focus();return false;}if(f.reset_password.value.length<6){document.getElementById("resetpw_alert").innerHTML='Password length should be greater than 6';f.reset_password.focus();return false;}if(f.reset_password.value!==f.reset_password2.value){document.getElementById("resetpw_alert").innerHTML='Please enter correct Confirm Password';f.reset_password2.focus();return false;}document.getElementById("page").value='setuserpwdAction';var parameter=f.reset_username.value+'@@@'+'';checkSetUserName(parameter);}
function setpassword(){var f=document.resetpw;document.getElementById("setpw_alert").innerHTML='';if(f.set_password.value.length<6){document.getElementById("setpw_alert").innerHTML='Password length should be greater than 6';f.set_password.focus();return false;}if(f.set_password.value!==f.set_password2.value){document.getElementById("setpw_alert").innerHTML='Please enter correct Confirm Password';f.set_password2.focus();return false;}document.getElementById("page").value='setpwdAction';f.action='register.php';f.submit();}
function cancelSignUp(){var f=document.add_employee;f.action='company_check.php';f.submit();}
function sendValidationEmailResponse(){if(http.readyState===4){var r=http.responseText;if(r==='true'){document.getElementById("sign_up_alert_comp").innerHTML="Validation link sent.";}else if(r==='refresh'){window.location.reload();if(document.getElementById("sign_up_alert_comp")){document.getElementById("sign_up_alert_comp").innerHTML="Email is already validated.";}}else{document.getElementById("sign_up_alert_comp").innerHTML="Error in sending validation link";}}}
function sendValidationEmail(id){var url="user_sendvalidation.php?u_id="+id+"&page=resend";http=createRequestObject();http.onreadystatechange=sendValidationEmailResponse;http.open("GET",url);http.send(null);}
function createFieldsInFixPage(fixCount){var newdiv,divid,content,container;newdiv=document.createElement("div");newdiv.setAttribute("name",'div_prob'+fixCount);newdiv.setAttribute("id",'div_prob'+fixCount);newdiv.setAttribute("class",'problem');divid='div_prob'+fixCount;content='<p><label for=title'+fixCount+'>Title <a id=anchor'+fixCount+' href=javascript:removeFixrow('+fixCount+') >Remove</a></label><input name=title'+fixCount+' id=title'+fixCount+' type=text class=fancylabel title=2 size=55 /><span id=problem_title'+fixCount+' class=error-msg></span></p>';content+='<p><label for=description'+fixCount+'>Description</label><textarea name=description'+fixCount+' id=description'+fixCount+' class=fancylabel title=2 rows=5 cols=50></textarea><span id=problem_description'+fixCount+' class=error-msg></span></p>';newdiv.innerHTML=content;container=document.getElementById("addmoredivs");container.appendChild(newdiv);document.getElementById('title'+fixCount).title="Eg: Won't switch off ...";document.getElementById('description'+fixCount).title="Describe the problem in full ...";Global.init();}
function addMorefixesInFixPage(){for(var i=1;i<=eval(addMorefixCount);i++){var title="title"+i;var description="description"+i;if(result.find(i)&&result.length>0){}else{if(document.getElementById("div_prob"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('problem_'+title).innerHTML='';document.getElementById('problem_'+description).innerHTML='';if(document.getElementById(title)){if(isEmpty(document.getElementById(title).value)||(document.getElementById(title).value==="Eg: Won't switch off ...")){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('problem_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}}
if(document.getElementById(description)){if(isEmpty(document.getElementById(description).value)||(document.getElementById(description).value==="Describe the problem in full ...")){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('problem_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}}addMorefixCount=eval(addMorefixCount+1);createFieldsInFixPage(addMorefixCount);}
function removeFixrow(divNum){deleteedFixRowCnt++;result[deleteedFixRowCnt]=divNum;if(deleteedFixRowId){deleteedFixRowId=deleteedFixRowId+','+divNum;}else{deleteedFixRowId=divNum;}var d1=document.getElementById('addmoredivs');var d2=document.getElementById('div_prob'+divNum);d1.removeChild(d2);var prsentFixCnt=parseInt(document.getElementById('presentFixCnt').value,10);var m=1;for(var i=1;i<=eval(addMorefixCount);i++){var title="title"+i;var description="description"+i;if(result.find(i)&&result.length>0){}else{if(i!==1){m++;}}}}
function createFieldsInIdeaPage(ideaCount){var newdiv,divid,content,container;newdiv=document.createElement("div");newdiv.setAttribute("name",'div_idea'+ideaCount);newdiv.setAttribute("id",'div_idea'+ideaCount);newdiv.setAttribute("class",'idea');divid='div_idea'+ideaCount;content='<p><label for=title'+ideaCount+'>Title <a id=anchor'+ideaCount+' href=javascript:removeIdearow('+ideaCount+') >Remove</a></label><input name=title'+ideaCount+' id=title'+ideaCount+' type=text class=fancylabel title=2 size=55 /><span id=idea_title'+ideaCount+' class=error-msg></span></p>';content+='<p><label for=description'+ideaCount+'>Description</label><textarea name=description'+ideaCount+' id=description'+ideaCount+' class=fancylabel title=2 rows=5 cols=50></textarea><span id=idea_description'+ideaCount+' class=error-msg></span></p>';newdiv.innerHTML=content;container=document.getElementById("addmoredivs");container.appendChild(newdiv);document.getElementById('title'+ideaCount).title="Eg: Turn the screen off to save the battery ...";document.getElementById('description'+ideaCount).title="Describe the idea in full ...";Global.init();}
function addMoreideasInFixPage(){for(var i=1;i<=eval(addMoreideaCount);i++){var title="title"+i;var description="description"+i;if(resultIdea.find(i)&&resultIdea.length>0){}else{if(document.getElementById("div_idea"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('idea_'+title).innerHTML='';document.getElementById('idea_'+description).innerHTML='';if(document.getElementById(title)){if(isEmpty(document.getElementById(title).value)||(document.getElementById(title).value==="Eg: Turn the screen off to save the battery ...")){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('idea_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}}
if(document.getElementById(description)){if(isEmpty(document.getElementById(description).value)||(document.getElementById(description).value==="Describe the idea in full ...")){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('idea_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}}addMoreideaCount=eval(addMoreideaCount+1);createFieldsInIdeaPage(addMoreideaCount);}
function removeIdearow(divNum){deleteedIdeaRowCnt++;resultIdea[deleteedIdeaRowCnt]=divNum;if(deleteedIdeaRowId){deleteedIdeaRowId=deleteedIdeaRowId+','+divNum;}else{deleteedIdeaRowId=divNum;}var d1=document.getElementById('addmoredivs');var d2=document.getElementById('div_idea'+divNum);d1.removeChild(d2);var prsentIdeaCnt=parseInt(document.getElementById('presentIdeaCnt').value,10);var m=1;for(var i=1;i<=eval(addMoreideaCount);i++){var title="title"+i;var description="description"+i;if(resultIdea.find(i)&&resultIdea.length>0){}else{if(i!==1){m++;}}}}
function registerRedirect(url){location.href=url;}
function convertProAccount(){document.getElementById("convert_pro_account").style.display='none';document.getElementById("convert_pro_account_action").className='';}
function convertProCancel(){document.getElementById("convert_pro_account_action").className='starthidden';document.getElementById("convert_pro_account").style.display='';}
function convertProSubmitResponse(){if(http_request.readyState===4){if(http_request.status===200){var result=http_request.responseText;if(result==='true'){document.getElementById("convert_pro_account_action").style.display='none';document.getElementById("sign_up_alert_comp").innerHTML='Your free account has been successfully converted to professional account';}else{document.getElementById("convert_pro_alert").innerHTML='Transaction denied. Invalid Credit card information. Please retry.';}}else{alert('There was a problem with the request.');}}}
function convertProSubmiyPost(url,parameters){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){}}}if(!http_request){alert('Cannot create XMLHTTP instance');return false;}http_request.onreadystatechange=convertProSubmitResponse;http_request.open('POST',url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function convertProSubmit(){var f=document.update_profile;document.getElementById("convert_pro_alert").innerHTML='';var d=new Date();var curr_month=d.getMonth();var curr_year=d.getFullYear();for(i=0;i<f.card_type.length;i++){if(f.card_type[i].checked){var radio_value=f.card_type[i].value;}}if(!radio_value){document.getElementById("convert_pro_alert").innerHTML='Please select card type';return false;}if(isEmpty(f.ccnumber.value)){document.getElementById("convert_pro_alert").innerHTML='Please enter Credit Card Number';f.ccnumber.focus();return false;}if(!isInteger(f.ccnumber.value)){document.getElementById("convert_pro_alert").innerHTML='Please enter Valid Credit Card Number';f.ccnumber.focus();return false;}if(isEmpty(f.name_on_card.value)){document.getElementById("convert_pro_alert").innerHTML='Please enter Name';f.name_on_card.focus();return false;}
if(isEmpty(f.expdate_month.value)){document.getElementById("convert_pro_alert").innerHTML='Please enter Expiration Month';f.expdate_month.focus();return false;}if(!isNumber(f.expdate_month.value)){document.getElementById("convert_pro_alert").innerHTML='Please enter Valid Expiration Month';f.expdate_month.focus();return false;}if(isEmpty(f.expdate_year.value)){document.getElementById("convert_pro_alert").innerHTML='Please enter Expiration Year';f.expdate_year.focus();return false;}if(!isNumber(f.expdate_year.value)){document.getElementById("convert_pro_alert").innerHTML='Please enter Valid Expiration Year';f.expdate_year.focus();return false;}if(f.expdate_year.value===curr_year&&f.expdate_month.value<curr_month){document.getElementById("convert_pro_alert").innerHTML='Your card is Expired. Please choose different Expiration Month/Year.';f.expdate_month.focus();return false;}
if(isEmpty(f.cvv_cvv2.value)){document.getElementById("convert_pro_alert").innerHTML='Please enter CVV/CVV2';f.cvv_cvv2.focus();return false;}var parameters="card_type="+radio_value+"&ccnumber="+f.ccnumber.value+"&name_on_card="+f.name_on_card.value+"&expdate_month="+f.expdate_month.value+"&expdate_year="+f.expdate_year.value+"&cvv_cvv2="+f.cvv_cvv2.value+"&action=convertpro";convertProSubmiyPost("company_update_cc_details.php",parameters);}function acceptConvertAccount(){document.getElementById("ConvertAccountRow1").style.display='none';document.getElementById("ConvertAccountRow2").style.display='none';document.getElementById("convert_pro_account").style.display='none';document.getElementById("convert_pro_account_action").className='';document.getElementById("convert_pro_alert").innerHTML='Please fill the payment infomation to convert to professional ';scroll(0,800);}
function rejectConvertAccountResponse(){if(http.readyState===4){var r=http.responseText;document.getElementById("sign_up_alert_comp").innerHTML='Request rejected';document.getElementById("ConvertAccountRow1").style.display='none';document.getElementById("ConvertAccountRow2").style.display='none';}}
function rejectConvertAccount(){var url="check_company_users.php?&page=rejectpro";http=createRequestObject();http.onreadystatechange=rejectConvertAccountResponse;http.open("GET",url);http.send(null);}
function acceptInvitation(iv_id,cmp_id){document.getElementById("acceptinvi").value='Y';document.getElementById("inviteTable").className='extrainfo';document.getElementById("user_alertmsg").innerHTML='Please enter additional information and update the profile to become employee ';document.getElementById("acceptinvicmpid").value=cmp_id;document.getElementById("acceptinviid").value=iv_id;}
function hideInviteTable(){document.getElementById("acceptinvi").value='N';document.getElementById("inviteTable").className='extrainfo starthidden';document.getElementById("user_alertmsg").innerHTML='&nbsp;';document.getElementById("acceptinvicmpid").value='';document.getElementById("acceptinviid").value='';}
function denyInvitationResponse(){if(http.readyState===4){var r=http.responseText;if(document.getElementById("alertInvitation"+r)){document.getElementById("alertInvitation"+r).style.display='none';}}}
function denyInvitation(cmp_id){var url="user_sendvalidation.php?cmp_id="+cmp_id+"&page=denyinvite";http=createRequestObject();http.onreadystatechange=denyInvitationResponse;http.open("GET",url);http.send(null);}
function changeEmailRegister(){if(document.getElementById("newEmailRegister").style.display==='none'){document.getElementById("newEmailRegister").style.display='';document.getElementById("newEmailRegisterText").innerHTML='Cancel';document.getElementById("emailChanged").value="Y";}else{document.getElementById("newEmailRegister").style.display='none';document.getElementById("newEmailRegisterText").innerHTML='Change Email';document.getElementById("emailChanged").value="N";}}
function nextsetProblems(num){var form_name=document.comproblems;form_name.pageprobs.value=num;form_name.submit();}
function nextsetProduct(num){var form_name=document.add_company_products;form_name.prodpage.value=num;form_name.submit();}
function nextsetProductAp(num){var form_name=document.products_fans;form_name.prodappage.value=num;form_name.submit();}
function nextsetEmployee(num){var form_name=document.addemployee;form_name.emppage.value=num;form_name.submit();}
function nextset(num){var form_name=document.fixlist;form_name.page.value=num;form_name.submit();}
function nextsetProblem(num,url){var form_name=document.fixlist;form_name.page.value=num;form_name.tab.value=url;form_name.action=form_name.currenturl.value+'/'+url;form_name.submit();}
function nextsetIdea(num,url){var form_name=document.fixlist;form_name.ipage.value=num;form_name.tab.value=url;form_name.action=form_name.currenturl.value+'/'+url;form_name.submit();}
function addProductToPanelResponse(){if(http.readyState===4){var r=http.responseText;if(document.getElementById("addToPanel"+r)){document.getElementById("addToPanel"+r).innerHTML='<font size="-1" style="color:#FF0000 ">Product added to your control panel</font>';}}}
function addProductToPanel(pid){var url="check_company_users.php?pid="+pid+"&page=addtocp";http=createRequestObject();http.onreadystatechange=addProductToPanelResponse;http.open("GET",url);http.send(null);}
function removeInviteResponse(){if(http.readyState===4){var r=http.responseText;if(document.getElementById("removeinviterow"+r)){document.getElementById("inviteCnt").value=eval(parseInt(document.getElementById("inviteCnt").value,10)-1);document.getElementById("removeinviterow"+r).style.display='none';document.getElementById("removeInviteAlert").innerHTML='Invitation has been cancelled';if(parseInt(document.getElementById("inviteCnt").value,10)===0){document.getElementById("removeinvite").style.display='none';}}}}
function removeInvite(id){var url="approve_employee.php?emp_id="+id+"&page=removeinvite";http=createRequestObject();http.onreadystatechange=removeInviteResponse;http.open("GET",url);http.send(null);}
function showInformation(){if(document.getElementById("centerbodyhidden").style.display==='none'){document.getElementById("readinformation").innerHTML='Hide information';document.getElementById("centerbodyhidden").style.display='';}else{document.getElementById("readinformation").innerHTML='Read more';document.getElementById("centerbodyhidden").style.display='none';}}
function companySignUpBilling(){var strcheck,domain,parameter;var f=document.add_company;document.getElementById("sign_up_alert_comp").innerHTML='';if(isEmpty(f.street.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Street';f.street.focus();window.scroll(0,260);return false;}if(isEmpty(f.city.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter City';f.city.focus();window.scroll(0,260);return false;}if(isEmpty(f.province.value)&&parseInt(f.country.value,10)===254){document.getElementById("sign_up_alert_comp").innerHTML='Please enter State/Province';f.province.focus();window.scroll(0,260);return false;}if(parseInt(f.country.value,10)===''||parseInt(f.country.value,10)===0){document.getElementById("sign_up_alert_comp").innerHTML='Please select Country';f.country.focus();window.scroll(0,260);return false;}
if(isEmpty(f.zipcode.value)&&parseInt(f.country.value,10)===254){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Zipcode';f.zipcode.focus();window.scroll(0,260);return false;}if(!isNumber(f.zipcode.value)&&parseInt(f.country.value,10)===254){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Valid Zipcode';f.zipcode.focus();window.scroll(0,260);return false;}if(!(f.privacy_policy.checked)){document.getElementById("sign_up_alert_comp").innerHTML='Please Accept Privacy Policy';f.privacy_policy.focus();return false;}if(!(f.terms.checked)){document.getElementById("sign_up_alert_comp").innerHTML='Please Accept Terms and Conditions';f.terms.focus();return false;}if(!(f.refund_policy.checked)){document.getElementById("sign_up_alert_comp").innerHTML='Please Accept Refund Policy';f.refund_policy.focus();return false;}
document.getElementById("public_nickname").disabled=false;document.getElementById("com_email").disabled=false;if(document.getElementById("account_type").value==='free'){}f.submit();}
function backtoRegister(){var f=document.add_company;f.action=f.backurl.value;f.submit();}
function companySignUpaddiInfo(){var f=document.add_company;document.getElementById("sign_up_alert_comp").innerHTML='';if(isEmpty(f.additional_info.value)||f.additional_info.value==="Please provide information about the size and nature of your company, including a website address if available ..."){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Additional Information';f.additional_info.focus();return false;}f.submit();}
function backtoBilling(){var f=document.add_company;f.action=f.backurl.value;f.submit();}
function loginKeyboard1(e,action,pid){var keyCode=e.keyCode||window.event.keyCode;if(parseInt(keyCode,10)===13){if(action==="addidea"){loginToAddIdea(pid);}if(action==="addproblem"){loginToAddFix(pid);}if(action==="addproduct"){loginToAddFix_1();}}}
function ReplaceAll(searchStr,replaceStr,origStr){if(origStr.indexOf(searchStr)!==-1){origStr=origStr.replace(searchStr,replaceStr);}if(origStr.indexOf(searchStr)===-1){return origStr;}else{return ReplaceAll(searchStr,replaceStr,origStr);}}
function trim2(str){str=this!==window?this:str;return str.replace(/^\s+/,'').replace(/\s+$/,'');}
function commentsNextSet_Response(){if(http.readyState===4){var r=http.responseText;var divID="";if(commentType==='F'){divID="commentsFixList_"+commentListId;}else if(commentType==='I'){divID="commentsIdeaList_"+commentListId;}document.getElementById(divID).innerHTML=r;}}
function showComments(id,type){var divID="";if(type==='F'){divID="commentsFixList_"+id;}else if(type==='I'){divID="commentsIdeaList_"+id;}if(document.getElementById(divID).style.display===""){document.getElementById(divID).style.display="none";}else{document.getElementById(divID).style.display="";}}
function commentsNextSet(id,type,linkNum){var url="commentsNextSet.php?id="+id+"&type="+type+"&linkNum="+linkNum;commentListId=id;commentType=type;http=createRequestObject();http.onreadystatechange=commentsNextSet_Response;http.open("GET",url);http.send(null);}
function commentsNextUserSet(id,type,linkNum){var url="commentsNextSet.php?id="+id+"&type="+type+"&linkNum="+linkNum+"&users=yes";commentListId=id;commentType=type;http=createRequestObject();http.onreadystatechange=commentsNextSet_Response;http.open("GET",url);http.send(null);}
function deleteComments_Response(){if(http.readyState===4){var r=http.responseText;var divID="";if(commentType==='F'){divID="commentsFixListDiv_"+commentListId;}else if(commentType==='I'){divID="commentsIdeaListDiv_"+commentListId;}document.getElementById(divID).innerHTML=r;}}
function showCommentsSet(id,type,linkNum){var url="commentsNextSet.php?id="+id+"&type="+type+"&action=showall&linkNum="+linkNum;commentListId=id;commentType=type;http=createRequestObject();http.onreadystatechange=deleteComments_Response;http.open("GET",url);http.send(null);}
function addCommentsBox(id,type,show){if(document.getElementById("login_section_div")){document.getElementById("login_section_div").innerHTML="";}var divID="";var contentDivID="";if(commentType==='F'){divID="commentsFixListDiv_"+commentListId;contentDivID="addFixComments_"+commentListId;}else if(commentType==='I'){divID="commentsIdeaListDiv_"+commentListId;contentDivID="addIdeaComments_"+commentListId;}if(document.getElementById(contentDivID)){document.getElementById(contentDivID).readOnly=false;}if(document.getElementById('priceList1_')){document.getElementById('priceList1_').innerHTML="";}divID="";var alertdivID="";if(type==='F'){divID="addFixCommentsDiv_"+id;alertdivID="alertFixId"+id;}else if(type==='I'){divID="addIdeaCommentsDiv_"+id;alertdivID="alertIdeaId"+id;}document.getElementById(alertdivID).innerHTML="";if(document.getElementById(divID).style.display==='none'){document.getElementById(divID).style.display=show;}else{document.getElementById(divID).style.display='none';}}
var user_active='';var alertdivID="";function addComments_Response(){if(http.readyState===4){var r=http.responseText;var divID="";if(commentType==='F'){divID="commentsFixListDiv_"+commentListId;}else if(commentType==='I'){divID="commentsIdeaListDiv_"+commentListId;}document.getElementById(divID).innerHTML=r;if(user_active==='N'){document.getElementById(alertdivID).innerHTML="Your Comment is not visible to the public until you have validated your email address";}if(user_active==='Y'){document.getElementById(alertdivID).innerHTML="Comment added";}}}
function addCommentsLogin_Response(){if(http.readyState===4){var r=http.responseText;var divID="";var contentDivID="";if(commentType==='F'){divID="commentsFixListDiv_"+commentListId;contentDivID="addFixComments_"+commentListId;}else if(commentType==='I'){divID="commentsIdeaListDiv_"+commentListId;contentDivID="addIdeaComments_"+commentListId;}document.getElementById(contentDivID).readOnly=true;document.getElementById("login_section_div").innerHTML=r;document.getElementById("login_section_div").style.display="block";divID="modalComment";document.getElementById(divID).className='modal';document.getElementById('overlay').style.display='block';}}
function addComments(active,id,type,e){alertdivID="";if(document.getElementById("login_section_div")){document.getElementById("login_section_div").innerHTML="";}if(document.getElementById('priceList1_')){document.getElementById('priceList1_').innerHTML="";}var divID="";var mainAddDiv="";user_active=active;var isNS4=document.layers?true:false;var isIE=/MSIE/.test(navigator.userAgent);var isNS6=!isIE&&document.getElementById?true:false;mouseX=(isNS4||isNS6)?e.clientX:event.clientX;mouseY=(isNS4||isNS6)?e.clientY:event.clientY;if(type==='F'){divID="addFixComments_"+id;alertdivID="alertFixId"+id;mainAddDiv="addFixCommentsDiv_"+id;}else if(type==='I'){divID="addIdeaComments_"+id;alertdivID="alertIdeaId"+id;mainAddDiv="addIdeaCommentsDiv_"+id;}
document.getElementById(divID).className="fancylabel";var userComments1=trim2(document.getElementById(divID).value);var userComments=document.getElementById(divID).value;if(userComments1===""||userComments1==="Have your say ..."){document.getElementById(divID).className="fancylabel validation-fail";document.getElementById(alertdivID).innerHTML="Please enter your Comment";document.getElementById(divID).focus();}else{var i=0;while(userComments.length!==i){if(userComments.charAt(i)==='\n'){userComments=userComments.replace('\n','<br>');userComments=userComments.replace('\n','<BR>');userComments=userComments.replace(' ','&nbsp;');}i++;}
userComments=ReplaceAll('"','%22',userComments);userComments=ReplaceAll('&','%26',userComments);var url="commentsNextSet.php?id="+id+"&type="+type+"&action=add&comments="+userComments;commentListId=id;commentType=type;http=createRequestObject();if(isuser==='Y'){http.onreadystatechange=addComments_Response;document.getElementById(mainAddDiv).style.marginLeft=100+"px";document.getElementById(mainAddDiv).innerHTML="<br>Please wait adding your Comment";}else{http.onreadystatechange=addCommentsLogin_Response;}http.open("GET",url);http.send(null);}}
function showLoginPanel(){var divID="modalCommentsignup";document.getElementById('modalComment').className='starthidden';document.getElementById(divID).className='modal';}
function loginPanelHide(id){var divID="";var contentDivID="";if(commentType==='F'){divID="commentsFixListDiv_"+commentListId;contentDivID="addFixComments_"+commentListId;}else if(commentType==='I'){divID="commentsIdeaListDiv_"+commentListId;contentDivID="addIdeaComments_"+commentListId;}document.getElementById(contentDivID).readOnly=false;divID=id;document.getElementById(divID).className='login starthidden';document.getElementById('overlay').style.display='none';}
function add_comment_check_user_response(){if(http.readyState===4){var r=http.responseText;var split_res=r.split("##");var f=document.fixlist;if(r==='false'){document.getElementById("loginAlertComment").innerHTML="The username or password you entered is incorrect.";f.login_u_username.focus();}else{if(split_res[2]==='N'){document.getElementById("loginAlertComment").innerHTML="Your Comment is not visible to the public until you have validated your email address.";}if(split_res[2]==='Y'){document.getElementById("loginAlertComment").innerHTML="Comment added.";}f.action='fixlist.php';f.submit();}}}
function add_comment_check_user(username,password,cid){var url='check_user_name.php?username='+username+'&password='+password+'&checkUser=yes&addcomment=yes&cid='+cid;http=createRequestObject();http.onreadystatechange=add_comment_check_user_response;http.open("GET",url);http.send(null);}
function loginToAddComment(cid){var f=document.fixlist;document.getElementById("loginAlertComment").innerHTML="";if(isEmpty(f.login_u_username.value)){document.getElementById("loginAlertComment").innerHTML='Please enter Username';f.login_u_username.focus();return false;}if(isEmpty(f.login_u_password.value)){document.getElementById("loginAlertComment").innerHTML='Please enter Password';f.login_u_password.focus();return false;}f.cid.value=cid;add_comment_check_user(f.login_u_username.value,f.login_u_password.value,f.cid.value);}
function loginKeyboardComment(e,action,pid){var keyCode=e.keyCode||window.event.keyCode;if(parseInt(keyCode,10)===13){loginToAddComment(action,pid);}}
function checkUserName_add_comment_response(){if(http.readyState===4){var r=http.responseText;var f=document.fixlist;f.u_username.className='';f.captcha_code1.className='';f.u_email.className='';var split_res=r.split("###");if(parseInt(split_res[0],10)===1){document.getElementById("add_comment_sign_up_alert").innerHTML="Please choose different Username, username already exists";f.u_username.focus();f.u_username.className='validation-fail';}else if(parseInt(split_res[0],10)===2){document.getElementById("add_comment_sign_up_alert").innerHTML="The code you entered is not valid .";document.getElementById("conf_code1").value=split_res[1];document.getElementById("captcha_code_img1").src=split_res[2];f.captcha_code1.value='';f.captcha_code1.focus();f.captcha_code1.className='validation-fail';}else if(parseInt(split_res[0],10)===4){document.getElementById("add_comment_sign_up_alert").innerHTML="Please enter different Email Id, Email Id already exists";f.u_email.focus();f.u_email.className='validation-fail';}
else{f.action='login_action.php?action_type=add_comment_sign_up';f.submit();}}}
function checkUserName_add_comment(val,email){var url='check_user_name.php?queryString='+val+'&email='+email;http=createRequestObject();http.onreadystatechange=checkUserName_add_comment_response;http.open("GET",url);http.send(null);}
function singupToAddComment(cid){var f=document.fixlist;document.getElementById("add_comment_sign_up_alert").innerHTML='';f.u_username.className='';f.u_password.className='';f.conf_u_password.className='';f.u_zipcode1.className='';f.u_email.className='';f.captcha_code1.className='';f.u_country.className='';if(isEmpty(f.u_username.value)){document.getElementById("add_comment_sign_up_alert").innerHTML='Please enter Username';f.u_username.focus();f.u_username.className='validation-fail';return false;}if(isEmpty(f.u_password.value)){document.getElementById("add_comment_sign_up_alert").innerHTML='Please enter a Password';f.u_password.focus();f.u_password.className='validation-fail';return false;}if(f.u_password.value.length<6){document.getElementById("add_comment_sign_up_alert").innerHTML='Password length should be greater than 6';f.u_password.focus();f.u_password.className='validation-fail';return false;}
if(f.u_password.value!==f.conf_u_password.value){document.getElementById("add_comment_sign_up_alert").innerHTML='Please enter correct Confirm Password';f.conf_u_password.focus();f.conf_u_password.className='validation-fail';return false;}if(parseInt(f.u_country.value,10)===''||parseInt(f.u_country.value,10)===0){document.getElementById("add_comment_sign_up_alert").innerHTML='Please select Country';f.u_country.focus();f.u_country.className='validation-fail';return false;}if(isEmpty(f.u_zipcode1.value)&&parseInt(f.u_country.value,10)===254){document.getElementById("add_comment_sign_up_alert").innerHTML='Please enter Zipcode';f.u_zipcode1.focus();f.u_zipcode1.className='validation-fail';return false;}if(isEmpty(f.u_email.value)){document.getElementById("add_comment_sign_up_alert").innerHTML='Please enter Email';f.u_email.focus();f.u_email.className='validation-fail';return false;}
if(!isEmail(f.u_email.value)){document.getElementById("add_comment_sign_up_alert").innerHTML='Please enter valid Email';f.u_email.focus();f.u_email.className='validation-fail';return false;}if(isEmpty(f.captcha_code1.value)){document.getElementById("add_comment_sign_up_alert").innerHTML='Please enter the Code';f.captcha_code1.focus();f.captcha_code1.className='validation-fail';return false;}if(eval(parseInt(f.first_var_fix.value,10)+parseInt(f.second_var_fix.value,10))!==parseInt(f.captcha_code1.value,10)){document.getElementById("add_comment_sign_up_alert").innerHTML='Please enter the correct answer';var rand_first_var=Math.floor((9-1)*Math.random())+1;f.first_var_fix.value=rand_first_var;document.getElementById("first_num_fix").innerHTML=rand_first_var;var rand_second_var=Math.floor((9-1)*Math.random())+1;f.second_var_fix.value=rand_second_var;document.getElementById("second_num_fix").innerHTML=rand_second_var;f.captcha_code1.focus();f.captcha_code1.className='validation-fail';return false;}
f.cid.value=cid;checkUserName_add_comment(f.u_username.value,f.u_email.value);}
function deleteComments(id,cid,type){if(confirm("R u sure? you want to delete this comment!")){commentListId=id;commentType=type;var url="commentsNextSet.php?id="+id+"&cid="+cid+"&type="+type+"&action=delete";http=createRequestObject();http.onreadystatechange=deleteComments_Response;http.open("GET",url);http.send(null);}}
function sortcolumn_Response(){if(http.readyState===4){var r=http.responseText;var divID="";if(commentType==='F'){divID="productFixDiv_"+commentListId+"_fix";}else if(commentType==='FL'){divID="productFixListDiv";}else if(commentType==='I'){divID="productFixDiv_"+commentListId+"_idea";}else if(commentType==='IL'){divID="productIdeaListDiv";}document.getElementById(divID).innerHTML=r;}else{var topHeight=0;if(navigator.appName==="Microsoft Internet Explorer"){topHeight=parseInt(document.body.scrollTop+200,10)+'px';}else{topHeight=parseInt(window.pageYOffset+200,10)+'px';}}}
function sortcolumnAction(id,type){var titleID="input_Title_"+type+"_"+id;var titleIDDiv="sort_Title_"+type+"_"+id;document.getElementById(titleIDDiv).style.display="none";var statusID="input_Status_"+type+"_"+id;var statusIDDiv="sort_Status_"+type+"_"+id;document.getElementById(statusIDDiv).style.display="none";var employeeID="input_Employee_"+type+"_"+id;var employeeIDDiv="sort_Employee_"+type+"_"+id;document.getElementById(employeeIDDiv).style.display="none";var repliesID="input_Replies_"+type+"_"+id;var repliesIDDiv="sort_Replies_"+type+"_"+id;document.getElementById(repliesIDDiv).style.display="none";var votesID="input_Votes_"+type+"_"+id;var votesIDDiv="sort_Votes_"+type+"_"+id;document.getElementById(repliesIDDiv).style.display="none";commentListId=id;commentType=type;var url="company_controlpanel_ajax.php?id="+id+"&type="+type+"&title="+document.getElementById(titleID).value+"&statusid="+document.getElementById(statusID).value+"&employeeName="+document.getElementById(employeeID).value+"&replies="+document.getElementById(repliesID).value+"&votes="+document.getElementById(votesID).value;http=createRequestObject();http.onreadystatechange=sortcolumn_Response;http.open("GET",url);http.send(null);}
function sortcolumnClose(id,type,col,action){var divid="sort_"+col+"_"+type+"_"+id;var inputID="input_"+col+"_"+type+"_"+id;document.getElementById(divid).style.display="none";if(action!=='Hide'){document.getElementById(inputID).value='';sortcolumnAction(id,type);}}
function sortcolumnNew(id,type,col){var divid="sort_"+col+"_"+type+"_"+id;document.getElementById(divid).style.display="";}
function sortcolumnInput(id,type,val,e){var keyCode=e.keyCode||window.event.keyCode;if(parseInt(keyCode,10)===13){sortcolumnAction(id,type);}}
function sortcolumnDropdown(id,type,val,col){var statusID="input_"+col+"_"+type+"_"+id;document.getElementById(statusID).value=val;sortcolumnAction(id,type);}var fixId="";var fixType="";function viewReplies(id,type){if(document.getElementById("pop_up_title")){document.getElementById("pop_up_title").innerHTML="Comments Details";}var divID="viewReplies";var divInnerID="viewRepliesInnerId";var createDivId='';if(type==='F'||type==='FL'){createDivId="commentsFixListDiv_"+id;}else if(type==='I'||type==='IL'){createDivId="commentsIdeaListDiv_"+id;}fixId=id;fixType=type;if(document.getElementById(divID).style.display==='none'){document.getElementById(divInnerID).innerHTML="";document.getElementById('overlay').style.display='block';document.getElementById(divInnerID).innerHTML="<div id='"+createDivId+"' ></div>";document.getElementById(divID).style.display='block';showCommentsSet(id,type,0);}else{document.getElementById(divID).style.display='none';document.getElementById('overlay').style.display='none';}}
function closeComments(){if(document.getElementById("pop_up_title")){document.getElementById("pop_up_title").innerHTML="Comments Details";}if(document.getElementById("replyCnt"+fixId)){var replyCnt=document.getElementById("replyCnt"+fixId).value;var replyCntDiv="";var replyListCntDiv="";if(fixType==='F'){replyCntDiv="replyDiv_F_"+fixId;replyListCntDiv="replyDiv_FL_"+fixId;if(document.getElementById(replyCntDiv)){document.getElementById(replyCntDiv).innerHTML=replyCnt;}document.getElementById(replyListCntDiv).innerHTML=replyCnt;}if(fixType==='I'){replyCntDiv="replyDiv_I_"+fixId;replyListCntDiv="replyDiv_IL_"+fixId;if(document.getElementById(replyCntDiv)){document.getElementById(replyCntDiv).innerHTML=replyCnt;}document.getElementById(replyListCntDiv).innerHTML=replyCnt;}}document.getElementById("viewReplies").style.display='none';document.getElementById('overlay').style.display='none';}
function editFix_Response(){if(http.readyState===4){var r=http.responseText;var divID="";if(commentType==='F'||commentType==='FL'){divID="commentsFixListDiv_"+commentListId;}else if(commentType==='I'||commentType==='IL'){divID="commentsFixListDiv_"+commentListId;}document.getElementById(divID).innerHTML=r;document.getElementById('overlay').style.display='block';}}
function editFix(id,type){var divID="viewReplies";var divInnerID="viewRepliesInnerId";var createDivId="commentsFixListDiv_"+id;if(document.getElementById("pop_up_title")){document.getElementById("pop_up_title").innerHTML="Edit Details";}fixId=id;if(document.getElementById(divID).style.display==='none'){document.getElementById(divInnerID).innerHTML="";document.getElementById(divInnerID).innerHTML="<div id='"+createDivId+"' ></div>";document.getElementById(divID).style.display="block";var url="company_controlpanel_ajax.php?id="+id+"&type="+type+"&action=edit";commentListId=id;commentType=type;http=createRequestObject();http.onreadystatechange=editFix_Response;http.open("GET",url);http.send(null);}else{document.getElementById(divID).style.display='none';document.getElementById('overlay').style.display='none';}}
function updateFix_Response(){if(http.readyState===4){var r=http.responseText;var divID="";var divIDL="";if(commentType==='F'||commentType==='FL'){divID="Title_F_"+commentListId;divIDL="Title_FL_"+commentListId;}else if(commentType==='I'||commentType==='IL'){divID="Title_I_"+commentListId;divIDL="Title_IL_"+commentListId;}if(document.getElementById(divID)){document.getElementById(divID).innerHTML=r;}document.getElementById(divIDL).innerHTML=r;document.getElementById('viewReplies').style.display='none';document.getElementById('overlay').style.display='none';}}
function updateFix(id,type){document.getElementById("alertSection").innerHTML='';if(isEmpty(document.getElementById("title").value)){document.getElementById("alertSection").style.display='block';document.getElementById("alertSection").innerHTML='Please enter Title';document.getElementById("title").focus();return false;}if(document.getElementById("description").value===''){document.getElementById("alertSection").style.display='block';document.getElementById("alertSection").innerHTML='Please enter Description';document.getElementById("description").focus();return false;}var url="company_controlpanel_ajax.php?id="+id+"&type="+type+"&action=save&title="+document.getElementById("title").value+"&description="+document.getElementById("description").value;commentListId=id;commentType=type;http=createRequestObject();http.onreadystatechange=updateFix_Response;http.open("GET",url);http.send(null);}
function changeStatus_Response(){if(http.readyState===4){var r=http.responseText;r=r.split("##@@@##");var divID="";var divIDL="";if(fixType==='F'||fixType==='FL'){divID="status_F_"+fixId;divIDL="status_FL_"+fixId;}else if(fixType==='I'||fixType==='IL'){divID="status_I_"+fixId;divIDL="status_IL_"+fixId;}if(document.getElementById(divID)){document.getElementById(divID).innerHTML=r[0];}document.getElementById(divIDL).innerHTML=r[1];}}
function changeStatus(mainId,type,statusid){var url="company_controlpanel_ajax.php?id="+mainId+"&type="+type+"&action=changeStatus&statusId="+statusid;fixId=mainId;fixType=type;http=createRequestObject();http.onreadystatechange=changeStatus_Response;http.open("GET",url);http.send(null);}
function changeEmployee_Response(){if(http.readyState===4){var r=http.responseText;r=r.split("##@@@##");var divID="";var divIDL="";if(fixType==='F'||fixType==='FL'){divID="employee_F_"+fixId;divIDL="employee_FL_"+fixId;}else if(fixType==='I'||fixType==='IL'){divID="employee_I_"+fixId;divIDL="employee_IL_"+fixId;}if(document.getElementById(divID)){document.getElementById(divID).innerHTML=r[0];}document.getElementById(divIDL).innerHTML=r[1];}}
function changeEmployee(mainId,type,empId){var url="company_controlpanel_ajax.php?id="+mainId+"&type="+type+"&action=changeEmployee&empId="+empId;fixId=mainId;fixType=type;http=createRequestObject();http.onreadystatechange=changeEmployee_Response;http.open("GET",url);http.send(null);}
function statusMouserOver(id,type){var statusDivId="statusmouserovertext_"+type+"_"+id;document.getElementById(statusDivId).style.display="";}
function statusMouseOut(id,type){var statusDivId="statusmouserovertext_"+type+"_"+id;document.getElementById(statusDivId).style.display="none";}
function employeeMouserOver(id,type){var statusDivId="employeemouserovertext_"+type+"_"+id;document.getElementById(statusDivId).style.display="";}
function employeeMouseOut(id,type){var statusDivId="employeemouserovertext_"+type+"_"+id;document.getElementById(statusDivId).style.display="none";}
function addMoreProducts(){if(document.getElementById("add_product_table_id").style.display){document.getElementById("add_product_table_id").style.display="";}else{document.getElementById("add_product_table_id").style.display="none";}}var more_fix_comp=1;
function addFixesIdeas(){document.getElementById('add_product_alert').innerHTML='';var prdouct_fieldName=document.getElementById('productNameId').value;var i,title,description;document.getElementById(prdouct_fieldName).className='fancylabel';document.getElementById('add_product_alert').innerHTML="";if(isEmpty(document.getElementById(prdouct_fieldName).value)){document.getElementById('add_product_alert').innerHTML="Please enter the Prodcut Name";document.getElementById(prdouct_fieldName).className='fancylabel validation-fail';document.getElementById(prdouct_fieldName).focus();return false;}for(i=1;i<=more_fix_comp;i++){title="comp_title"+i;description="comp_description"+i;if(resultProductComp.find(i)&&resultProductComp.length>0){}
else{if(document.getElementById("div_prob"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('problem_'+title).innerHTML='';document.getElementById('problem_'+description).innerHTML='';if(isEmpty(document.getElementById(title).value)){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('problem_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}if(isEmpty(document.getElementById(description).value)){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('problem_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}for(i=1;i<=more_idea_comp;i++){if(more_idea_comp>0){title="comp_idea_title"+i;description="comp_idea_description"+i;if(resultProductIdeaComp.find(i)&&resultProductIdeaComp.length>0){}
else{if(document.getElementById("div_idea"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('idea_'+title).innerHTML='';document.getElementById('idea_'+description).innerHTML='';if(isEmpty(document.getElementById(title).value)){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('idea_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}if(isEmpty(document.getElementById(description).value)){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('idea_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}}
document.getElementById("total_fix_count").value=more_fix_comp;document.getElementById("total_idea_count").value=more_idea_comp;document.getElementById("deletedFixRowIdComp").value=deletedFixRowIdComp;document.getElementById("deletedIdeaRowIdComp").value=deletedIdeaRowIdComp;for(i=1; i<=more_fix_comp;i++){description = "comp_description"+i;if(document.getElementById("div_prob"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}for(i=1; i<=more_idea_comp; i++){description = "comp_idea_description"+i;if(document.getElementById("div_idea"+i)){if(document.getElementById(description)){var v=0;while(document.getElementById(description).value.length!==v){if(document.getElementById(description).value.charAt(v)==='\n'){document.getElementById(description).value=document.getElementById(description).value.replace('\n','<br>');document.getElementById(description).value=document.getElementById(description).value.replace('\n','<BR>');document.getElementById(description).value=document.getElementById(description).value.replace(' ','&nbsp;');}v++;}}}}document.getElementById('productName').value=document.getElementById(prdouct_fieldName).value;var form_name=document.add_company_products;form_name.action="user_action.php?action_type=add_company_products";form_name.submit();}
function createFields_comp(more_fix_comp){var newdiv,divid,content,container;newdiv=document.createElement("div");newdiv.setAttribute("name",'div_prob'+more_fix_comp);newdiv.setAttribute("id",'div_prob'+more_fix_comp);newdiv.setAttribute("class",'problem');divid='div_prob'+more_fix_comp;content='<p><label for=title'+more_fix_comp+'>Problem Title <a id=anchor'+more_fix_comp+' href=javascript:removerowComp('+more_fix_comp+') >Remove</a></label><input name=comp_title'+more_fix_comp+' id=comp_title'+more_fix_comp+' type=text class=fancylabel size=55 /><span id=problem_comp_title'+more_fix_comp+' class=error-msg></span></p>';content+='<p><label for=description'+more_fix_comp+'>Problem Description</label><textarea name=comp_description'+more_fix_comp+' id=comp_description'+more_fix_comp+' class=fancylabel rows=5 cols=50></textarea><span id=problem_comp_description'+more_fix_comp+' class=error-msg></span></p>';newdiv.innerHTML=content;container=document.getElementById("addmoredivs");container.appendChild(newdiv);}function addMoreFixesComp(){for(var i=1;i<=eval(more_fix_comp);i++){var title="comp_title"+i;var description="comp_description"+i;if(resultProductComp.find(i)&&resultProductComp.length>0){}
else{if(document.getElementById("div_prob"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('problem_'+title).innerHTML='';document.getElementById('problem_'+description).innerHTML='';if(isEmpty(document.getElementById(title).value)){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('problem_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}if(isEmpty(document.getElementById(description).value)){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('problem_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}more_fix_comp=eval(more_fix_comp+1);createFields_comp(more_fix_comp);}
function removerowComp(divNum){deletedFixRowCntComp++;resultProductComp[deletedFixRowCntComp]=divNum;if(deletedFixRowIdComp){deletedFixRowIdComp=deletedFixRowIdComp+','+divNum;}else{deletedFixRowIdComp=divNum;}var d1=document.getElementById('addmoredivs');var d2=document.getElementById('div_prob'+divNum);d1.removeChild(d2);var m=1;for(var i=1;i<=eval(more_fix_comp);i++){var title="title"+i;var description="description"+i;if(resultProductComp.find(i)&&resultProductComp.length>0){}else{if(i!==1){m++;}}}}
function removerowIdeaComp(divNum){deletedIdeaRowCntComp++;resultProductIdeaComp[deletedIdeaRowCntComp]=divNum;if(deletedIdeaRowIdComp){deletedIdeaRowIdComp=deletedIdeaRowIdComp+','+divNum;}else{deletedIdeaRowIdComp=divNum;}var d1=document.getElementById('addmoredivs');var d2=document.getElementById('div_idea'+divNum);d1.removeChild(d2);var m=1;for(var i=1;i<=eval(more_idea_comp);i++){var title="comp_description_idea"+i;var description="comp_description_idea"+i;if(resultProductIdeaComp.find(i)&&resultProductIdeaComp.length>0){}else{if(i!==1){m++;}}}}
function createFields_comp_idea(more_idea_comp){var newdiv,divid,content,container;newdiv=document.createElement("div");newdiv.setAttribute("name",'div_idea'+more_idea_comp);newdiv.setAttribute("id",'div_idea'+more_idea_comp);newdiv.setAttribute("class",'idea');divid='div_idea'+more_idea_comp;content='<p><label for=title'+more_idea_comp+'>Idea Title <a id=anchor'+more_idea_comp+' href=javascript:removerowIdeaComp('+more_idea_comp+') >Remove</a></label><input name=comp_idea_title'+more_idea_comp+' id=comp_idea_title'+more_idea_comp+' type=text class=fancylabel size=55 /><span id=idea_comp_idea_title'+more_idea_comp+' class=error-msg></span></p>';content+='<p><label for=description'+more_idea_comp+'>Idea Description</label><textarea name=comp_idea_description'+more_idea_comp+' id=comp_idea_description'+more_idea_comp+' class=fancylabel rows=5 cols=50></textarea><span id=idea_comp_idea_description'+more_idea_comp+' class=error-msg></span></p>';newdiv.innerHTML=content;container=document.getElementById("addmoredivs");container.appendChild(newdiv);}
function addMoreIdeasComp(){if(more_idea_comp>0){for(var i=1;i<=eval(more_idea_comp);i++){var title="comp_idea_title"+i;var description="comp_idea_description"+i;if(resultProductIdeaComp.find(i)&&resultProductIdeaComp.length>0){}else{if(document.getElementById("div_idea"+i)){document.getElementById(title).className='fancylabel';document.getElementById(description).className='fancylabel';document.getElementById('idea_'+title).innerHTML='';document.getElementById('idea_'+description).innerHTML='';if(isEmpty(document.getElementById(title).value)){document.getElementById(title).className='fancylabel validation-fail';document.getElementById('idea_'+title).innerHTML="Please enter the Title";document.getElementById(title).focus();return false;}
if(isEmpty(document.getElementById(description).value)){document.getElementById(description).className='fancylabel validation-fail';document.getElementById('idea_'+description).innerHTML="Please enter the Description";document.getElementById(description).focus();return false;}}}}}more_idea_comp=eval((more_idea_comp)+1);createFields_comp_idea(more_idea_comp);}
function details_update_Response(){if(http.readyState===4){var r=http.responseText;var f=document.cc_details_form;if(r==='declined'){document.getElementById("sign_up_alert_comp").innerHTML='Transaction denied. Invalid Credit card information. Please retry.';return false;}f.submit();}}
function details_update(){var f=document.cc_details_form;document.getElementById("sign_up_alert_comp").innerHTML='';var d=new Date();var curr_month=d.getMonth();var curr_year=d.getFullYear();for(i=0;i<f.card_type.length;i++){if(f.card_type[i].checked){var radio_value=f.card_type[i].value;}}if(!radio_value){document.getElementById("sign_up_alert_comp").innerHTML='Please select card type';return false;}if(isEmpty(f.ccnumber.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Credit Card Number';f.ccnumber.focus();return false;}if(!isInteger(f.ccnumber.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Valid Credit Card Number';f.ccnumber.focus();return false;}
if(isEmpty(f.name_on_card.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Name';f.name_on_card.focus();return false;}if(isEmpty(f.expdate_month.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Expiration Month';f.expdate_month.focus();return false;}if(!isNumber(f.expdate_month.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Valid Expiration Month';f.expdate_month.focus();return false;}
if(isEmpty(f.expdate_year.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Expiration Year';f.expdate_year.focus();return false;}if(!isNumber(f.expdate_year.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Valid Expiration Year';f.expdate_year.focus();return false;}if(f.expdate_year.value===curr_year&&f.expdate_month.value<curr_month){document.getElementById("sign_up_alert_comp").innerHTML='Your card is Expired. Please choose different Expiration Month/Year.';f.expdate_month.focus();return false;}
if(isEmpty(f.cvv_cvv2.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter CVV/CVV2';f.cvv_cvv2.focus();return false;}var url="company_update_cc_details.php?card_type="+radio_value+"&ccnumber="+f.ccnumber.value+"&name_on_card="+f.name_on_card.value+"&expdate_month="+f.expdate_month.value+"&expdate_year="+f.expdate_year.value+"&cvv_cvv2="+f.cvv_cvv2.value+"&action=update";http=createRequestObject();http.onreadystatechange=details_update_Response;http.open("GET",url);http.send(null);}
function details_update_close_Response(){if(http.readyState===4){Show_sign_up1('cc_details_div');}}
function details_update_close(){var url="company_update_cc_details.php?&action=closePopup";http=createRequestObject();http.onreadystatechange=details_update_close_Response;http.open("GET",url);http.send(null);}
function companySignUpPayNew(){var f=document.add_company;document.getElementById("sign_up_alert_comp").innerHTML='&nbsp;';var d=new Date();var curr_month=d.getMonth();var curr_year=d.getFullYear();for(i=0;i<f.card_type.length;i++){if(f.card_type[i].checked){var radio_value=f.card_type[i].value;}}if(!radio_value){document.getElementById("sign_up_alert_comp").innerHTML='Please select card type';return false;}if(isEmpty(f.ccnumber.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Credit Card Number';f.ccnumber.focus();return false;}
if(!isInteger(f.ccnumber.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Valid Credit Card Number';f.ccnumber.focus();return false;}if(isEmpty(f.name_on_card.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Name';f.name_on_card.focus();return false;}if(isEmpty(f.expdate_month.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Expiration Month';f.expdate_month.focus();return false;}if(!isNumber(f.expdate_month.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Valid Expiration Month';f.expdate_month.focus();return false;}
if(isEmpty(f.expdate_year.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Expiration Year';f.expdate_year.focus();return false;}if(!isNumber(f.expdate_year.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter Valid Expiration Year';f.expdate_year.focus();return false;}if(f.expdate_year.value===curr_year&&f.expdate_month.value<curr_month){document.getElementById("sign_up_alert_comp").innerHTML='Your card is Expired. Please choose different Expiration Month/Year.';f.expdate_month.focus();return false;}if(isEmpty(f.cvv_cvv2.value)){document.getElementById("sign_up_alert_comp").innerHTML='Please enter CVV/CVV2';f.cvv_cvv2.focus();return false;}f.action='company_register_pay.php';f.submit();}